@dropins/tools 0.23.0-alpha33 → 0.23.0-alpha43
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/chunks/debounce__BF4Cdv7Ils.js +2 -0
- package/chunks/debounce__BF4Cdv7Ils.js.map +1 -0
- package/chunks/image-params-keymap__LH6wjfp1fd.js +12 -0
- package/chunks/image-params-keymap__LH6wjfp1fd.js.map +1 -0
- package/chunks/vcomponent__BjnR-FRhjl.js +2 -0
- package/chunks/vcomponent__BjnR-FRhjl.js.map +1 -0
- package/components/Accordion.js +2 -0
- package/components/Accordion.js.map +1 -0
- package/components/ActionButton.js +2 -0
- package/components/ActionButton.js.map +1 -0
- package/components/ActionButtonGroup.js +2 -0
- package/components/ActionButtonGroup.js.map +1 -0
- package/components/AlertBanner.js +2 -0
- package/components/AlertBanner.js.map +1 -0
- package/components/Breadcrumbs.js +2 -0
- package/components/Breadcrumbs.js.map +1 -0
- package/components/Button.js +2 -0
- package/components/Button.js.map +1 -0
- package/components/Card.js +2 -0
- package/components/Card.js.map +1 -0
- package/components/CartItem.js +2 -0
- package/components/CartItem.js.map +1 -0
- package/components/CartList.js +2 -0
- package/components/CartList.js.map +1 -0
- package/components/Checkbox.js +2 -0
- package/components/Checkbox.js.map +1 -0
- package/components/ColorSwatch.js +2 -0
- package/components/ColorSwatch.js.map +1 -0
- package/components/Divider.js +2 -0
- package/components/Divider.js.map +1 -0
- package/components/Field.js +2 -0
- package/components/Field.js.map +1 -0
- package/components/Icon.js +1 -1
- package/components/Icon.js.map +1 -1
- package/components/IllustratedMessage.js +2 -0
- package/components/IllustratedMessage.js.map +1 -0
- package/components/Image.js +3 -0
- package/components/Image.js.map +1 -0
- package/components/ImageSwatch.js +2 -0
- package/components/ImageSwatch.js.map +1 -0
- package/components/InLineAlert.js +2 -0
- package/components/InLineAlert.js.map +1 -0
- package/components/Incrementer.js +2 -0
- package/components/Incrementer.js.map +1 -0
- package/components/Input.js +2 -0
- package/components/Input.js.map +1 -0
- package/components/Modal.js +2 -0
- package/components/Modal.js.map +1 -0
- package/components/Picker.js +2 -0
- package/components/Picker.js.map +1 -0
- package/components/Price.js +2 -0
- package/components/Price.js.map +1 -0
- package/components/PriceRange.js +2 -0
- package/components/PriceRange.js.map +1 -0
- package/components/PriceSummary.js +2 -0
- package/components/PriceSummary.js.map +1 -0
- package/components/ProgressSpinner.js +2 -0
- package/components/ProgressSpinner.js.map +1 -0
- package/components/RadioButton.js +2 -0
- package/components/RadioButton.js.map +1 -0
- package/components/Skeleton.js +2 -0
- package/components/Skeleton.js.map +1 -0
- package/components/TextSwatch.js +2 -0
- package/components/TextSwatch.js.map +1 -0
- package/components/UIProvider.js +1 -1
- package/components/UIProvider.js.map +1 -1
- package/components/index.js +2 -0
- package/components/index.js.map +1 -0
- package/i18n.js +4 -0
- package/i18n.js.map +1 -0
- package/initializer.js +31 -3
- package/initializer.js.map +1 -1
- package/lib/slot.js +2 -0
- package/lib/slot.js.map +1 -0
- package/package.json +1 -1
- package/chunks/image-params-keymap__DLgj2E8cak.js +0 -15
- package/chunks/image-params-keymap__DLgj2E8cak.js.map +0 -1
- package/chunks/preload-helper__uemlvruIqb.js +0 -2
- package/chunks/preload-helper__uemlvruIqb.js.map +0 -1
- package/lib/initializer.d.ts +0 -84
- package/lib/initializer.d.ts.map +0 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InLineAlert.js","sources":["../../src/components/InLineAlert/InLineAlert.tsx"],"sourcesContent":["import { Button, Icon } from '@adobe/elsie/components';\nimport { useText } from '@adobe/elsie/i18n';\nimport { Close } from '@adobe/elsie/icons';\nimport { VComponent, classes } from '@adobe/elsie/lib';\nimport { FunctionComponent, VNode } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\n\nimport '@adobe/elsie/components/InLineAlert/InLineAlert.css';\nexport interface InLineAlertProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'icon'> {\n heading: string;\n description?: string;\n type?: 'error' | 'warning' | 'success';\n icon?: VNode<HTMLAttributes<SVGSVGElement>>;\n additionalActions?: Array<{\n label: string;\n onClick: (event: Event) => void;\n }>;\n onDismiss?: (event: Event) => void;\n}\n\nexport const InLineAlert: FunctionComponent<InLineAlertProps> = ({\n className,\n type = 'warning',\n additionalActions,\n onDismiss,\n heading,\n description,\n icon,\n ...props\n}) => {\n const translations = useText({\n dismiss: 'Dropin.InlineAlert.dismissLabel',\n });\n\n return (\n <div\n {...props}\n className={classes([\n 'dropin-in-line-alert',\n `dropin-in-line-alert--${type}`,\n className,\n ])}\n >\n <div className={'dropin-in-line-alert__heading'}>\n <div className={'dropin-in-line-alert__title-container'}>\n {icon && (\n <VComponent node={icon} className={'dropin-in-line-alert__icon'} />\n )}\n\n <span className={'dropin-in-line-alert__title'}>{heading}</span>\n </div>\n\n <div className={'dropin-in-line-alert__actions-container'}>\n {additionalActions?.length == 1 && (\n <Button\n variant=\"tertiary\"\n className={'dropin-in-line-alert__additional-action'}\n onClick={additionalActions[0]?.onClick}\n aria-label={additionalActions[0]?.label}\n >\n {additionalActions[0]?.label}\n </Button>\n )}\n {onDismiss && (\n <Button\n icon={<Icon source={Close} size=\"24\" stroke=\"2\" />}\n className={'dropin-in-line-alert__dismiss-button'}\n variant=\"tertiary\"\n onClick={onDismiss}\n aria-label={translations.dismiss}\n />\n )}\n </div>\n </div>\n\n {description && (\n <p className={'dropin-in-line-alert__description'}>{description}</p>\n )}\n\n {additionalActions && additionalActions?.length > 1 && (\n <div className={'dropin-in-line-alert__additional-actions-container'}>\n {additionalActions.map((action) => (\n <Button\n key={action.label}\n variant=\"tertiary\"\n className={'dropin-in-line-alert__additional-action'}\n onClick={action.onClick}\n >\n {action.label}\n </Button>\n ))}\n </div>\n )}\n </div>\n );\n};\n"],"names":["InLineAlert","className","type","additionalActions","onDismiss","heading","description","icon","props","translations","useText","dismiss","_jsxs","classes","children","_jsx","VComponent","node","length","Button","variant","onClick","label","Icon","source","Close","size","stroke","map","action"],"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,EAAA,MAAA,CAAKd,UAAW,qDAAqDa,SAClEX,EAAkByB,IAAKC,GACtBd,EAACI,EAAM,CAELC,QAAQ,WACRnB,UAAW,0CACXoB,QAASQ,EAAOR,QAAQP,SAEvBe,EAAOP,KAAAA,EALHO,EAAOP,KAMN,CACT,CAAA,CACE,CACN,CAAA,CACE,CAET"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{useState as I,useEffect as V,useCallback as g}from"../preact-hooks.js";import{c as i}from"../chunks/classes__DJBjVfEyCI.js";import"../chunks/image-params-keymap__LH6wjfp1fd.js";import{d as L}from"../chunks/debounce__BF4Cdv7Ils.js";import"../preact.js";import{jsx as e}from"../preact-jsx-runtime.js";import S from"../chunks/Add__CiEO_sX7HP.js";import"../preact-compat.js";import z from"../chunks/Minus__CefO5Dkv_0.js";import{Icon as f}from"./Icon.js";import{Localizer as N,Text as h}from"../i18n.js";const G=({name:v,value:o="1",className:w,disabled:r,error:x,success:k,min:p,max:l,onValue:m,onUpdateError:a,size:_="medium",...y})=>{const[c,b]=I(Number(o)),s=Number(p),d=Number(l);V(()=>{b(Number(o))},[o]);const C=g(L(async t=>{if(m)try{await m(t)}catch(n){a&&a(n)}},200),[m,a]),u=t=>{let n=t;t<s&&(n=s),t>d&&(n=d),C(n),b(n)};return e("div",{className:i(["dropin-incrementer",`dropin-incrementer--${_}`,w]),children:e("div",{className:i(["dropin-incrementer__content",`dropin-incrementer__content--${_}`,["dropin-incrementer__content--error",x],["dropin-incrementer__content--success",k],["dropin-incrementer__content--disabled",r]]),children:[e("div",{className:i(["dropin-incrementer__button-container",["dropin-incrementer__button-container--disabled",r]]),children:e(N,{children:e("button",{type:"button",className:i(["dropin-incrementer__decrease-button",["dropin-incrementer__decrease-button--disabled",r]]),onClick:()=>u(c-1),disabled:r||c<s+1,"aria-label":e(h,{id:"Dropin.Incrementer.decreaseLabel"}),children:e(f,{source:z,size:"16",stroke:"1",viewBox:"4 2 20 20",className:"dropin-incrementer__down"})})})}),e("input",{className:"dropin-incrementer__input",max:l,min:p,step:1,type:"number",name:v,value:c,disabled:r,onChange:t=>{const n=t.currentTarget.value;n!==""&&u(Number(n))},...y}),e("div",{className:i(["dropin-incrementer__button-container",["dropin-incrementer__button-container--disabled",r]]),children:e(N,{children:e("button",{type:"button",className:i(["dropin-incrementer__increase-button",["dropin-incrementer__increase-button--disabled",r]]),onClick:()=>u(c+1),disabled:r||c>d-1,"aria-label":e(h,{id:"Dropin.Incrementer.increaseLabel"}),children:e(f,{source:S,size:"16",stroke:"1",viewBox:"4 2 20 20",className:"dropin-incrementer__add"})})})})]})})};export{G as Incrementer};
|
|
2
|
+
//# sourceMappingURL=Incrementer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Incrementer.js","sources":["../../src/components/Incrementer/Incrementer.tsx"],"sourcesContent":["import { FunctionComponent } from 'preact';\nimport { useState, useEffect, useCallback } from 'preact/hooks';\nimport { HTMLAttributes } from 'preact/compat';\nimport { classes, debounce } from '@adobe/elsie/lib';\nimport { Add, Minus } from '@adobe/elsie/icons';\nimport { Icon } from '@adobe/elsie/components/Icon';\nimport { Localizer, Text } from '@adobe/elsie/i18n';\nimport '@adobe/elsie/components/Incrementer/Incrementer.css';\n\nexport interface IncrementerProps\n extends Omit<HTMLAttributes<HTMLInputElement>, 'size'> {\n name?: string;\n size?: 'medium' | 'large';\n onValue?: (value: any) => void;\n onUpdateError?: (error: Error) => void;\n error?: boolean;\n success?: boolean;\n min?: number;\n max?: number;\n disabled?: boolean;\n maxLength?: number;\n}\n\nexport const Incrementer: FunctionComponent<IncrementerProps> = ({\n name,\n value = '1',\n className,\n disabled,\n error,\n success,\n min,\n max,\n onValue,\n onUpdateError,\n size = 'medium',\n ...props\n}) => {\n const [currentValue, setCurrentValue] = useState<number>(Number(value));\n const minValue = Number(min);\n const maxValue = Number(max);\n\n useEffect(() => {\n setCurrentValue(Number(value));\n }, [value]);\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const debouncedOnValueHandler = useCallback(\n debounce(async (newValue: any) => {\n if (onValue) {\n try {\n await onValue(newValue);\n } catch (e) {\n if (onUpdateError) {\n onUpdateError(e as Error);\n }\n }\n }\n }, 200),\n [onValue, onUpdateError]\n );\n\n const handleIncrementer = (_value: number) => {\n let newValue = _value;\n if (_value < minValue) newValue = minValue;\n if (_value > maxValue) newValue = maxValue;\n debouncedOnValueHandler(newValue);\n setCurrentValue(newValue);\n };\n\n return (\n <div\n className={classes([\n 'dropin-incrementer',\n `dropin-incrementer--${size}`,\n className,\n ])}\n >\n <div\n className={classes([\n 'dropin-incrementer__content',\n `dropin-incrementer__content--${size}`,\n [`dropin-incrementer__content--error`, error],\n [`dropin-incrementer__content--success`, success],\n [`dropin-incrementer__content--disabled`, disabled],\n ])}\n >\n {/* Minus Button */}\n <div\n className={classes([\n 'dropin-incrementer__button-container',\n [`dropin-incrementer__button-container--disabled`, disabled],\n ])}\n >\n <Localizer>\n <button\n type=\"button\"\n className={classes([\n 'dropin-incrementer__decrease-button',\n [`dropin-incrementer__decrease-button--disabled`, disabled],\n ])}\n onClick={() => handleIncrementer(currentValue - 1)}\n disabled={disabled || currentValue < minValue + 1}\n aria-label={\n (<Text id=\"Dropin.Incrementer.decreaseLabel\" />) as any\n }\n >\n <Icon\n source={Minus}\n size=\"16\"\n stroke=\"1\"\n viewBox=\"4 2 20 20\"\n className=\"dropin-incrementer__down\"\n />\n </button>\n </Localizer>\n </div>\n\n {/* Input Field */}\n <input\n className=\"dropin-incrementer__input\"\n max={max}\n min={min}\n step={1}\n type=\"number\"\n name={name}\n value={currentValue}\n disabled={disabled}\n onChange={(e) => {\n const newValue = e.currentTarget.value;\n if (newValue !== '') {\n handleIncrementer(Number(newValue));\n }\n }}\n {...props}\n />\n\n <div\n className={classes([\n 'dropin-incrementer__button-container',\n [`dropin-incrementer__button-container--disabled`, disabled],\n ])}\n >\n {/* Plus/Add button */}\n <Localizer>\n <button\n type=\"button\"\n className={classes([\n 'dropin-incrementer__increase-button',\n [`dropin-incrementer__increase-button--disabled`, disabled],\n ])}\n onClick={() => handleIncrementer(currentValue + 1)}\n disabled={disabled || currentValue > maxValue - 1}\n aria-label={\n (<Text id=\"Dropin.Incrementer.increaseLabel\" />) as any\n }\n >\n <Icon\n source={Add}\n size=\"16\"\n stroke=\"1\"\n viewBox=\"4 2 20 20\"\n className=\"dropin-incrementer__add\"\n />\n </button>\n </Localizer>\n </div>\n </div>\n </div>\n );\n};\n"],"names":["Incrementer","name","value","className","disabled","error","success","min","max","onValue","onUpdateError","size","props","currentValue","setCurrentValue","useState","Number","minValue","maxValue","useEffect","debouncedOnValueHandler","useCallback","debounce","newValue","e","handleIncrementer","_value","_jsx","classes","children","_jsxs","Localizer","type","onClick","Text","id","Icon","source","Minus","stroke","viewBox","step","onChange","currentTarget","Add"],"mappings":"0fAuBO,MAAMA,EAAmDA,CAAC,CAC/DC,KAAAA,EACAC,MAAAA,EAAQ,IACRC,UAAAA,EACAC,SAAAA,EACAC,MAAAA,EACAC,QAAAA,EACAC,IAAAA,EACAC,IAAAA,EACAC,QAAAA,EACAC,cAAAA,EACAC,KAAAA,EAAO,SACP,GAAGC,CACL,IAAM,CACJ,KAAM,CAACC,EAAcC,CAAe,EAAIC,EAAiBC,OAAOd,CAAK,CAAC,EAChEe,EAAWD,OAAOT,CAAG,EACrBW,EAAWF,OAAOR,CAAG,EAE3BW,EAAU,IAAM,CACEH,EAAAA,OAAOd,CAAK,CAAC,CAAA,EAC5B,CAACA,CAAK,CAAC,EAGV,MAAMkB,EAA0BC,EAC9BC,EAAS,MAAOC,GAAkB,CAChC,GAAId,EACE,GAAA,CACF,MAAMA,EAAQc,CAAQ,QACfC,EAAG,CACNd,GACFA,EAAcc,CAAW,CAE7B,GAED,GAAG,EACN,CAACf,EAASC,CAAa,CACzB,EAEMe,EAAqBC,GAAmB,CAC5C,IAAIH,EAAWG,EACXA,EAAST,IAAqBA,EAAAA,GAC9BS,EAASR,IAAqBA,EAAAA,GAClC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EK,KAAK,SACL7B,UAAWyB,EAAQ,CACjB,sCACA,CAAE,gDAAgDxB,CAAQ,CAAC,CAC5D,EACD6B,QAASA,IAAMR,EAAkBZ,EAAe,CAAC,EACjDT,SAAUA,GAAYS,EAAeK,EAAW,EAChD,aACGS,EAACO,EAAI,CAACC,GAAG,kCAAA,CAAoC,EAC/CN,SAEDF,EAACS,EAAI,CACHC,OAAQO,EACRjC,KAAK,KACL4B,OAAO,IACPC,QAAQ,YACRrC,UAAU,yBAAA,CACX,CAAA,CACK,CAAA,CACC,CAAA,CACR,CAAC,CAAA,CACH,CAAA,CACF,CAET"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Icon as _}from"./Icon.js";import"../preact-compat.js";import b from"../chunks/CheckWithCircle__D4l-TfZdbK.js";import k from"../chunks/WarningWithCircle__z1B4rFgzNa.js";import{c as n}from"../chunks/classes__DJBjVfEyCI.js";import"../chunks/image-params-keymap__LH6wjfp1fd.js";import{d as w}from"../chunks/debounce__BF4Cdv7Ils.js";import"../preact.js";import{jsx as i}from"../preact-jsx-runtime.js";import{V as y}from"../chunks/vcomponent__BjnR-FRhjl.js";import{useCallback as $}from"../preact-hooks.js";const q=({name:l,value:h,variant:u="primary",className:g,disabled:e,error:p,floatingLabel:t,onValue:c,onUpdateError:d,size:N="medium",icon:o,maxLength:v,success:m,...r})=>{const f=(r==null?void 0:r.id)||l||`dropin-input-${Math.random().toString(36)}`,x=$(w(async a=>{if(c)try{await c(a)}catch(s){d&&d(s)}},200),[c,d]),C=a=>{const s=a.target;x(s.value.trim())};return i("div",{className:n(["dropin-input-container",`dropin-input-container--${u}`,["dropin-input-container--floating",!!t],["dropin-input-container--disabled",e]]),children:[o&&i(y,{node:o,className:n(["dropin-input__field-icon--left",o.props.className])}),i("div",{className:"dropin-input-label-container",children:[i("input",{id:f,onChange:C,type:"text",maxLength:v,name:l,value:h,...r,className:n(["dropin-input",`dropin-input--${N}`,`dropin-input--${u}`,["dropin-input--error",!!p],["dropin-input--success",!!m],["dropin-input--disabled",e],["dropin-input--floating",!!t],["dropin-input--icon-left",!!o],g]),disabled:e}),t&&i("label",{htmlFor:f,className:n([["dropin-input__label--floating",!!t],["dropin-input__label--floating--icon-left",!!o],["dropin-input__label--floating--error",!!p]]),children:t})]}),p&&i("div",{className:n(["dropin-input__field-icon--right","dropin-input__field-icon--error"]),children:i(_,{source:k,size:"16",stroke:"2",className:"dropin-input--warning-icon",viewBox:"-1 -1 26 26"})}),m&&i("div",{className:n(["dropin-input__field-icon--right","dropin-input__field-icon--success"]),children:i(_,{source:b,size:"16",stroke:"2",className:"dropin-input--success-icon",viewBox:"-1 -1 26 26"})})]})};export{q as Input,q as default};
|
|
2
|
+
//# sourceMappingURL=Input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Input.js","sources":["../../src/components/Input/Input.tsx"],"sourcesContent":["import { Icon } from '@adobe/elsie/components/Icon';\nimport '@adobe/elsie/components/Input/Input.css';\nimport { CheckWithCircle, WarningWithCircle } from '@adobe/elsie/icons';\nimport { VComponent, classes, debounce } from '@adobe/elsie/lib';\nimport { FunctionComponent, VNode } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { useCallback } from 'preact/hooks';\n\nexport interface InputProps\n extends Omit<HTMLAttributes<HTMLInputElement>, 'size' | 'icon'> {\n id?: string;\n name?: string;\n variant?: 'primary' | 'secondary';\n disabled?: boolean;\n error?: boolean;\n floatingLabel?: string;\n onUpdateError?: (error: Error) => void;\n onValue?: (value: any) => void;\n size?: 'medium' | 'large';\n success?: boolean;\n icon?: VNode<HTMLAttributes<SVGSVGElement>>;\n maxLength?: number;\n}\n\nexport const Input: FunctionComponent<InputProps> = ({\n name,\n value,\n variant = 'primary',\n className,\n disabled,\n error,\n floatingLabel,\n onValue,\n onUpdateError,\n size = 'medium',\n icon,\n maxLength,\n success,\n ...props\n}) => {\n const id = props?.id || name || `dropin-input-${Math.random().toString(36)}`;\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const debouncedOnValueHandler = useCallback(\n debounce(async (newValue: any) => {\n if (onValue) {\n try {\n await onValue(newValue);\n } catch (e) {\n if (onUpdateError) {\n onUpdateError(e as Error);\n }\n }\n }\n }, 200),\n [onValue, onUpdateError]\n );\n\n const handleOnValue = (e: Event) => {\n const input = e.target as HTMLInputElement;\n\n debouncedOnValueHandler(input.value.trim());\n };\n\n return (\n <div\n className={classes([\n 'dropin-input-container',\n `dropin-input-container--${variant}`,\n [`dropin-input-container--floating`, !!floatingLabel],\n ['dropin-input-container--disabled', disabled],\n ])}\n >\n {icon && (\n <VComponent\n node={icon}\n className={classes([\n 'dropin-input__field-icon--left',\n icon.props.className,\n ])}\n />\n )}\n <div className=\"dropin-input-label-container\">\n {/* Input */}\n <input\n id={id}\n onChange={handleOnValue}\n type=\"text\"\n maxLength={maxLength}\n name={name}\n value={value}\n {...props}\n className={classes([\n 'dropin-input',\n `dropin-input--${size}`,\n `dropin-input--${variant}`,\n [`dropin-input--error`, !!error],\n [`dropin-input--success`, !!success],\n ['dropin-input--disabled', disabled],\n [`dropin-input--floating`, !!floatingLabel],\n [`dropin-input--icon-left`, !!icon],\n className,\n ])}\n disabled={disabled}\n />\n\n {/* Floating Label */}\n {floatingLabel && (\n <label\n htmlFor={id}\n className={classes([\n [`dropin-input__label--floating`, !!floatingLabel],\n [`dropin-input__label--floating--icon-left`, !!icon],\n [`dropin-input__label--floating--error`, !!error],\n ])}\n >\n {floatingLabel}\n </label>\n )}\n </div>\n\n {error && (\n <div\n className={classes([\n 'dropin-input__field-icon--right',\n 'dropin-input__field-icon--error',\n ])}\n >\n <Icon\n source={WarningWithCircle}\n size=\"16\"\n stroke=\"2\"\n className=\"dropin-input--warning-icon\"\n viewBox=\"-1 -1 26 26\"\n />\n </div>\n )}\n\n {success && (\n <div\n className={classes([\n 'dropin-input__field-icon--right',\n 'dropin-input__field-icon--success',\n ])}\n >\n <Icon\n source={CheckWithCircle}\n size=\"16\"\n stroke=\"2\"\n className=\"dropin-input--success-icon\"\n viewBox=\"-1 -1 26 26\"\n />\n </div>\n )}\n </div>\n );\n};\n"],"names":["Input","name","value","variant","className","disabled","error","floatingLabel","onValue","onUpdateError","size","icon","maxLength","success","props","id","Math","random","toString","debouncedOnValueHandler","useCallback","debounce","newValue","e","handleOnValue","input","target","trim","_jsxs","classes","children","_jsx","VComponent","node","onChange","type","htmlFor","Icon","source","WarningWithCircle","stroke","viewBox","CheckWithCircle"],"mappings":"4fAwBO,MAAMA,EAAuCA,CAAC,CACnDC,KAAAA,EACAC,MAAAA,EACAC,QAAAA,EAAU,UACVC,UAAAA,EACAC,SAAAA,EACAC,MAAAA,EACAC,cAAAA,EACAC,QAAAA,EACAC,cAAAA,EACAC,KAAAA,EAAO,SACPC,KAAAA,EACAC,UAAAA,EACAC,QAAAA,EACA,GAAGC,CACL,IAAM,CACEC,MAAAA,GAAKD,GAAAA,YAAAA,EAAOC,KAAMd,GAAS,gBAAee,KAAKC,OAAO,EAAEC,SAAS,EAAE,CAAE,GAGrEC,EAA0BC,EAC9BC,EAAS,MAAOC,GAAkB,CAChC,GAAId,EACE,GAAA,CACF,MAAMA,EAAQc,CAAQ,QACfC,EAAG,CACNd,GACFA,EAAcc,CAAW,CAE7B,GAED,GAAG,EACN,CAACf,EAASC,CAAa,CACzB,EAEMe,EAAiBD,GAAa,CAClC,MAAME,EAAQF,EAAEG,OAEQD,EAAAA,EAAMvB,MAAMyB,KAAM,CAAA,CAAA,EAG5C,OACEC,EAAA,MAAA,CACExB,UAAWyB,EAAQ,CACjB,yBACC,2BAA0B1B,CAAQ,GACnC,CAAE,mCAAmC,CAAC,CAACI,CAAa,EACpD,CAAC,mCAAoCF,CAAQ,CAAC,CAC/C,EAAEyB,SAEFnB,CAAAA,GACCoB,EAACC,EAAU,CACTC,KAAMtB,EACNP,UAAWyB,EAAQ,CACjB,iCACAlB,EAAKG,MAAMV,SAAS,CACrB,CAAA,CACF,EAEHwB,EAAA,MAAA,CAAKxB,UAAU,+BAA8B0B,UAE3CC,EAAA,QAAA,CACEhB,GAAAA,EACAmB,SAAUV,EACVW,KAAK,OACLvB,UAAAA,EACAX,KAAAA,EACAC,MAAAA,EAAa,GACTY,EACJV,UAAWyB,EAAQ,CACjB,eACC,iBAAgBnB,CAAK,GACrB,iBAAgBP,CAAQ,GACzB,CAAE,sBAAsB,CAAC,CAACG,CAAK,EAC/B,CAAE,wBAAwB,CAAC,CAACO,CAAO,EACnC,CAAC,yBAA0BR,CAAQ,EACnC,CAAE,yBAAyB,CAAC,CAACE,CAAa,EAC1C,CAAE,0BAA0B,CAAC,CAACI,CAAI,EAClCP,CAAS,CACV,EACDC,SAAAA,CAAAA,CACD,EAGAE,GACCwB,EAAA,QAAA,CACEK,QAASrB,EACTX,UAAWyB,EAAQ,CACjB,CAAE,gCAAgC,CAAC,CAACtB,CAAa,EACjD,CAAE,2CAA2C,CAAC,CAACI,CAAI,EACnD,CAAE,uCAAuC,CAAC,CAACL,CAAK,CAAC,CAClD,EAAEwB,SAEFvB,CAAAA,CACI,CACR,CAAA,CACE,EAEJD,GACCyB,EAAA,MAAA,CACE3B,UAAWyB,EAAQ,CACjB,kCACA,iCAAiC,CAClC,EAAEC,SAEHC,EAACM,EAAI,CACHC,OAAQC,EACR7B,KAAK,KACL8B,OAAO,IACPpC,UAAU,6BACVqC,QAAQ,aAAA,CACT,CAAA,CACE,EAGN5B,GACCkB,EAAA,MAAA,CACE3B,UAAWyB,EAAQ,CACjB,kCACA,mCAAmC,CACpC,EAAEC,SAEHC,EAACM,EAAI,CACHC,OAAQI,EACRhC,KAAK,KACL8B,OAAO,IACPpC,UAAU,6BACVqC,QAAQ,aAAA,CACT,CAAA,CACE,CACN,CAAA,CACE,CAET"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{c as t}from"../chunks/classes__DJBjVfEyCI.js";import"../chunks/image-params-keymap__LH6wjfp1fd.js";import"../preact.js";import{jsx as o}from"../preact-jsx-runtime.js";import{useText as w}from"../i18n.js";import"../preact-compat.js";import E from"./Button.js";import L from"../chunks/Close__DQxKl-RcDt.js";import{useCallback as N,useEffect as a}from"../preact-hooks.js";import"../chunks/vcomponent__BjnR-FRhjl.js";const K=({size:m="small",title:l=null,centered:u=!1,backgroundDim:p=!0,clickToDismiss:i=!0,escapeToDismiss:s=!0,onClose:n,showCloseButton:_=!0,className:v,children:f=null,...y})=>{const r=N(()=>{n==null||n()},[n]),h=w({modalCloseLabel:"Dropin.Modal.Close.label"});return a(()=>{const e=d=>{const b=document.querySelector(".dropin-modal"),c=document.querySelector(".dropin-modal__body");i&&b&&c&&!c.contains(d.target)&&r()};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[r,i]),a(()=>{const e=d=>{d.key==="Escape"&&s&&r()};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[r,s]),a(()=>{const e=document.scrollingElement,d=e.style.overflow;return e.style.overflow="hidden",()=>{e.style.overflow=d}},[]),o("div",{className:t(["dropin-modal",["dropin-modal--dim",p]]),children:o("div",{...y,className:t(["dropin-modal__body",[`dropin-modal__body--${m}`,m],v]),children:[o("div",{className:t(["dropin-modal__header",["dropin-modal__header-title",!!l]]),children:[l&&o("div",{className:t(["dropin-modal__header-title-content"]),children:l}),_&&o(E,{"aria-label":h.modalCloseLabel,variant:"tertiary",className:"dropin-modal__header-close-button",onClick:r,icon:o(L,{})})]}),o("div",{className:t(["dropin-modal__content",["dropin-modal__body--centered",u]]),children:f})]})})};export{K as Modal};
|
|
2
|
+
//# sourceMappingURL=Modal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Modal.js","sources":["../../src/components/Modal/Modal.tsx"],"sourcesContent":["/*\nADOBE CONFIDENTIAL\nCopyright 2023 Adobe\nAll Rights Reserved.\nNOTICE: All information contained herein is, and remains\nthe property of Adobe and its suppliers, if any. The intellectual\nand technical concepts contained herein are proprietary to Adobe\nand its suppliers and are protected by all applicable intellectual\nproperty laws, including trade secret and copyright laws.\nDissemination of this information or reproduction of this material\nis strictly forbidden unless prior written permission is obtained\nfrom Adobe.\n*/\n\nimport { useText } from '@adobe/elsie/i18n';\nimport { classes } from '@adobe/elsie/lib';\nimport {\n FunctionComponent,\n HTMLAttributes,\n useCallback,\n useEffect,\n} from 'preact/compat';\nimport { Button } from '../Button';\nimport { Close as CloseSVG } from '@adobe/elsie/icons';\nimport { VNode } from 'preact';\n\nimport '@adobe/elsie/components/Modal/Modal.css';\n\nexport interface ModalProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'size' | 'title'> {\n size?: 'small' | 'medium' | 'full';\n title?: VNode;\n centered?: boolean;\n onClose?: () => void;\n backgroundDim?: boolean;\n clickToDismiss?: boolean;\n escapeToDismiss?: boolean;\n showCloseButton?: boolean;\n}\n\nexport const Modal: FunctionComponent<ModalProps> = ({\n size = 'small',\n title = null,\n centered = false,\n backgroundDim = true,\n clickToDismiss = true,\n escapeToDismiss = true,\n onClose,\n showCloseButton = true,\n className,\n children = null,\n ...props\n}) => {\n const handleOnClose = useCallback(() => {\n onClose?.();\n }, [onClose]);\n\n const translations = useText({\n modalCloseLabel: 'Dropin.Modal.Close.label',\n });\n\n // Close on background click\n useEffect(() => {\n const handleOutsideClick = (event: MouseEvent) => {\n const modal = document.querySelector('.dropin-modal');\n const modalBody = document.querySelector('.dropin-modal__body');\n\n if (\n clickToDismiss &&\n modal &&\n modalBody &&\n !modalBody.contains(event.target as Node)\n ) {\n handleOnClose();\n }\n };\n\n document.addEventListener('mousedown', handleOutsideClick);\n\n return () => {\n document.removeEventListener('mousedown', handleOutsideClick);\n };\n }, [handleOnClose, clickToDismiss]);\n\n // Close on ESC\n useEffect(() => {\n const handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape' && escapeToDismiss) {\n handleOnClose();\n }\n };\n\n document.addEventListener('keydown', handleKeyDown);\n\n return () => {\n document.removeEventListener('keydown', handleKeyDown);\n };\n }, [handleOnClose, escapeToDismiss]);\n\n // Prevent document scrolling\n useEffect(() => {\n const scrollingElement = document.scrollingElement as HTMLElement;\n\n const defaultOverflowValue = scrollingElement.style.overflow;\n\n scrollingElement.style.overflow = 'hidden';\n\n return () => {\n scrollingElement.style.overflow = defaultOverflowValue;\n };\n }, []);\n\n return (\n <div\n className={classes([\n 'dropin-modal',\n ['dropin-modal--dim', backgroundDim],\n ])}\n >\n <div\n {...props}\n className={classes([\n 'dropin-modal__body',\n [`dropin-modal__body--${size}`, size],\n className,\n ])}\n >\n <div\n className={classes([\n 'dropin-modal__header',\n ['dropin-modal__header-title', !!title],\n ])}\n >\n {title && (\n <div className={classes(['dropin-modal__header-title-content'])}>\n {title}\n </div>\n )}\n\n {showCloseButton && (\n <Button\n aria-label={translations.modalCloseLabel}\n variant=\"tertiary\"\n className=\"dropin-modal__header-close-button\"\n onClick={handleOnClose}\n icon={<CloseSVG />}\n />\n )}\n </div>\n\n <div\n className={classes([\n 'dropin-modal__content',\n ['dropin-modal__body--centered', centered],\n ])}\n >\n {children}\n </div>\n </div>\n </div>\n );\n};\n"],"names":["Modal","size","title","centered","backgroundDim","clickToDismiss","escapeToDismiss","onClose","showCloseButton","className","children","props","handleOnClose","useCallback","translations","useText","modalCloseLabel","useEffect","handleOutsideClick","event","modal","document","querySelector","modalBody","contains","target","addEventListener","removeEventListener","handleKeyDown","key","scrollingElement","defaultOverflowValue","style","overflow","_jsx","classes","_jsxs","Button","variant","onClick","icon","CloseSVG"],"mappings":"oaAwCO,MAAMA,EAAuCA,CAAC,CACnDC,KAAAA,EAAO,QACPC,MAAAA,EAAQ,KACRC,SAAAA,EAAW,GACXC,cAAAA,EAAgB,GAChBC,eAAAA,EAAiB,GACjBC,gBAAAA,EAAkB,GAClBC,QAAAA,EACAC,gBAAAA,EAAkB,GAClBC,UAAAA,EACAC,SAAAA,EAAW,KACX,GAAGC,CACL,IAAM,CACEC,MAAAA,EAAgBC,EAAY,IAAM,CAC5BN,GAAA,MAAAA,GAAA,EACT,CAACA,CAAO,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A,CACE,EAGNM,GACC0B,EAACG,EAAM,CACL,aAAYvB,EAAaE,gBACzBsB,QAAQ,WACR7B,UAAU,oCACV8B,QAAS3B,EACT4B,KAAMN,EAACO,EAAU,EAAA,CAAA,CAClB,CACF,CAAA,CACE,EAELP,EAAA,MAAA,CACEzB,UAAW0B,EAAQ,CACjB,wBACA,CAAC,+BAAgChC,CAAQ,CAAC,CAC3C,EAAEO,SAAAA,CAAAA,CAGA,CAAC,CAAA,CACH,CAAA,CACF,CAET"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"../preact-compat.js";import j from"../chunks/ChevronDown__BQ2yC5Yu4N.js";import{c as t}from"../chunks/classes__DJBjVfEyCI.js";import"../chunks/image-params-keymap__LH6wjfp1fd.js";import"../preact.js";import{jsx as k}from"../preact-jsx-runtime.js";import{useState as E,useEffect as M,useRef as P}from"../preact-hooks.js";import{Icon as q}from"./Icon.js";const U=({name:x,value:l=null,options:r,variant:C="primary",floatingLabel:c,size:o="medium",handleSelect:w=()=>{},disabled:v=!1,error:y=!1,placeholder:i,defaultOption:e,icon:_,className:D,...n})=>{var $;const N=(n==null?void 0:n.id)||x||`dropin-picker-${Math.random().toString(36)}`,s=r==null?void 0:r.find(d=>!d.disabled),[F,a]=E({value:l,text:(e==null?void 0:e.text)||i||(s==null?void 0:s.text),icon:_});M(()=>{const d=r==null?void 0:r.find(m=>m.value===l);a(d??{value:(e==null?void 0:e.value)||(i||c?null:s==null?void 0:s.value),text:(e==null?void 0:e.text)||i||(s==null?void 0:s.text),icon:_})},[l,r,i,_,e,c]);const I=d=>{const{options:m,value:h}=d.target;for(const p of m)p.selected&&(a({value:h,text:p.text,icon:_}),w(d))},R=r==null?void 0:r.map(d=>{const{value:m,text:h,disabled:p}=d,V=m===F.value;return k("option",{value:m,selected:V,disabled:p,className:t(["dropin-picker__option"]),children:h},m)}),u=P(null),S=!(($=u.current)!=null&&$.selected)||!!e;return k("div",{className:t([D,"dropin-picker",`dropin-picker__${o}`,["dropin-picker__floating",!!c],["dropin-picker__selected",S],["dropin-picker__error",y],["dropin-picker__disabled",v],["dropin-picker__icon",_]]),children:[_&&k(_.type,{..._.props,className:"dropin-picker__icon--placeholder"}),k("select",{id:N,className:t(["dropin-picker__select",`dropin-picker__select--${C}`,`dropin-picker__select--${o}`,["dropin-picker__select--floating",!!c]]),name:x,"aria-label":x,disabled:v,onChange:I,...n,children:[!e&&(c||i)&&k("option",{value:"",ref:u,className:t(["dropin-picker__option dropin-picker__placeholder"]),children:c??i},l),R]}),k(q,{source:j,size:"24",stroke:"2",className:"dropin-picker__chevronDown"}),c&&S&&k("label",{htmlFor:N,className:t(["dropin-picker__floatingLabel",!!c]),children:c})]})};export{U as Picker};
|
|
2
|
+
//# sourceMappingURL=Picker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Picker.js","sources":["../../src/components/Picker/Picker.tsx"],"sourcesContent":["import { Icon } from '@adobe/elsie/components';\nimport '@adobe/elsie/components/Picker/Picker.css';\nimport { ChevronDown } from '@adobe/elsie/icons';\nimport { classes } from '@adobe/elsie/lib';\nimport { FunctionComponent, VNode } from 'preact';\nimport { HTMLAttributes, useEffect, useState } from 'preact/compat';\nimport { useRef } from 'preact/hooks';\n\nexport interface PickerOption {\n value: string | null;\n text?: string;\n icon?: VNode<HTMLAttributes<SVGSVGElement>>;\n disabled?: boolean;\n}\n\nexport interface PickerProps\n extends Omit<HTMLAttributes<HTMLSelectElement>, 'value' | 'size' | 'icon'> {\n id?: string;\n name?: string;\n value?: string | null;\n placeholder?: string;\n variant?: 'primary' | 'secondary';\n size?: 'medium' | 'large';\n floatingLabel?: string;\n icon?: VNode<HTMLAttributes<SVGSVGElement>>;\n options?: PickerOption[];\n defaultOption?: PickerOption;\n disabled?: boolean;\n error?: boolean;\n handleSelect?: (event: Event) => void;\n}\n\nexport const Picker: FunctionComponent<PickerProps> = ({\n name,\n value = null,\n options,\n variant = 'primary',\n floatingLabel,\n size = 'medium',\n handleSelect = () => {},\n disabled = false,\n error = false,\n placeholder,\n defaultOption,\n icon,\n className,\n ...props\n}) => {\n const id = props?.id || name || `dropin-picker-${Math.random().toString(36)}`;\n\n // find the first option that is not disabled\n const firstAvailableeOption = options?.find((option) => !option.disabled);\n\n const [selectedValue, setSelectedValue] = useState<PickerOption>({\n value,\n text: defaultOption?.text || placeholder || firstAvailableeOption?.text,\n icon,\n });\n\n useEffect(() => {\n const selected = options?.find((option) => option.value === value);\n\n setSelectedValue(\n selected ?? {\n value:\n (defaultOption?.value as string) ||\n ((placeholder || floatingLabel\n ? null\n : firstAvailableeOption?.value) as string),\n text: defaultOption?.text || placeholder || firstAvailableeOption?.text,\n icon,\n }\n );\n }, [value, options, placeholder, icon, defaultOption, floatingLabel]);\n\n const handleOptionClick = (event: Event) => {\n const { options, value } = event.target as HTMLSelectElement;\n\n for (const element of options) {\n if (element.selected) {\n setSelectedValue({ value, text: element.text, icon });\n handleSelect(event);\n }\n }\n };\n\n const optionsListItems = options?.map((option) => {\n const { value, text, disabled } = option;\n const selected = value === selectedValue.value;\n\n return (\n <option\n value={value as string}\n key={value}\n selected={selected}\n disabled={disabled}\n className={classes(['dropin-picker__option'])}\n >\n {text}\n </option>\n );\n });\n\n const placeholderOptionRef = useRef(null);\n // @ts-ignore\n const selected = !placeholderOptionRef.current?.selected || !!defaultOption;\n\n return (\n <div\n className={classes([\n className,\n 'dropin-picker',\n `dropin-picker__${size}`,\n ['dropin-picker__floating', !!floatingLabel],\n ['dropin-picker__selected', selected],\n ['dropin-picker__error', error],\n ['dropin-picker__disabled', disabled],\n ['dropin-picker__icon', icon],\n ])}\n >\n {icon && (\n // @ts-ignore\n <icon.type\n {...icon.props}\n className={'dropin-picker__icon--placeholder'}\n />\n )}\n\n <select\n id={id}\n className={classes([\n 'dropin-picker__select',\n `dropin-picker__select--${variant}`,\n `dropin-picker__select--${size}`,\n ['dropin-picker__select--floating', !!floatingLabel],\n ])}\n name={name}\n aria-label={name}\n disabled={disabled}\n onChange={handleOptionClick}\n {...props}\n >\n {!defaultOption && (floatingLabel || placeholder) && (\n <option\n value={''}\n key={value}\n ref={placeholderOptionRef}\n className={classes([\n 'dropin-picker__option dropin-picker__placeholder',\n ])}\n >\n {floatingLabel ?? placeholder}\n </option>\n )}\n\n {optionsListItems}\n </select>\n\n <Icon\n source={ChevronDown}\n size=\"24\"\n stroke=\"2\"\n className=\"dropin-picker__chevronDown\"\n />\n\n {floatingLabel && selected && (\n <label\n htmlFor={id}\n className={classes(['dropin-picker__floatingLabel', !!floatingLabel])}\n >\n {floatingLabel}\n </label>\n )}\n </div>\n );\n};\n"],"names":["Picker","name","value","options","variant","floatingLabel","size","handleSelect","disabled","error","placeholder","defaultOption","icon","className","props","id","Math","random","toString","firstAvailableeOption","find","option","selectedValue","setSelectedValue","useState","text","useEffect","selected","handleOptionClick","event","target","element","optionsListItems","map","_jsx","classes","children","placeholderOptionRef","useRef","current","_jsxs","type","onChange","ref","Icon","source","ChevronDown","stroke","htmlFor"],"mappings":"wWAgCO,MAAMA,EAAyCA,CAAC,CACrDC,KAAAA,EACAC,MAAAA,EAAQ,KACRC,QAAAA,EACAC,QAAAA,EAAU,UACVC,cAAAA,EACAC,KAAAA,EAAO,SACPC,aAAAA,EAAeA,IAAM,CAAC,EACtBC,SAAAA,EAAW,GACXC,MAAAA,EAAQ,GACRC,YAAAA,EACAC,cAAAA,EACAC,KAAAA,EACAC,UAAAA,EACA,GAAGC,CACL,IAAM,OACEC,MAAAA,GAAKD,GAAAA,YAAAA,EAAOC,KAAMd,GAAS,iBAAgBe,KAAKC,OAAO,EAAEC,SAAS,EAAE,CAAE,GAGtEC,EAAwBhB,GAAAA,YAAAA,EAASiB,KAAiBC,GAAA,CAACA,EAAOb,UAE1D,CAACc,EAAeC,CAAgB,EAAIC,EAAuB,CAC/DtB,MAAAA,EACAuB,MAAMd,GAAAA,YAAAA,EAAec,OAAQf,IAAeS,GAAAA,YAAAA,EAAuBM,MACnEb,KAAAA,CAAAA,CAC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CAAQ,EACpC,CAAC,sBAAuBI,CAAI,CAAC,CAC9B,EAAEwB,UAEFxB,GAECsB,EAACtB,EAAK6B,KAAI,CAAA,GACJ7B,EAAKE,MACTD,UAAW,kCAAA,CACZ,EAGH2B,EAAA,SAAA,CACEzB,GAAAA,EACAF,UAAWsB,EAAQ,CACjB,wBACC,0BAAyB/B,CAAQ,GACjC,0BAAyBE,CAAK,GAC/B,CAAC,kCAAmC,CAAC,CAACD,CAAa,CAAC,CACrD,EACDJ,KAAAA,EACA,aAAYA,EACZO,SAAAA,EACAkC,SAAUd,EAAkB,GACxBd,EAAKsB,SAAA,CAER,CAACzB,IAAkBN,GAAiBK,IACnCwB,EAAA,SAAA,CACEhC,MAAO,GAEPyC,IAAKN,EACLxB,UAAWsB,EAAQ,CACjB,kDAAkD,CACnD,EAAEC,SAEF/B,GAAiBK,CAAAA,EANbR,CAOC,EAGT8B,CAAgB,CAAA,CACX,EAERE,EAACU,EAAI,CACHC,OAAQC,EACRxC,KAAK,KACLyC,OAAO,IACPlC,UAAU,4BACX,CAAA,EAEAR,GAAiBsB,GAChBO,EAAA,QAAA,CACEc,QAASjC,EACTF,UAAWsB,EAAQ,CAAC,+BAAgC,CAAC,CAAC9B,CAAa,CAAC,EAAE+B,SAErE/B,CAAAA,CACI,CACR,CAAA,CACE,CAET"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"../preact-compat.js";import{c as u}from"../chunks/classes__DJBjVfEyCI.js";import"../chunks/image-params-keymap__LH6wjfp1fd.js";import"../preact.js";import{jsx as f}from"../preact-jsx-runtime.js";import{useMemo as t}from"../preact-hooks.js";const y=({amount:r=0,currency:i,locale:o=void 0,variant:s="default",weight:c="bold",className:n,children:x,sale:p=!1,formatOptions:e={},size:a="small",...d})=>{const m=t(()=>new Intl.NumberFormat(o,{style:"currency",currency:i||"USD",minimumFractionDigits:2,maximumFractionDigits:2,...e}),[o,i,e]),l=t(()=>m.format(r),[r,m]);return f("span",{...d,className:u(["dropin-price",`dropin-price--${s}`,`dropin-price--${a}`,`dropin-price--${c}`,["dropin-price--sale",p],n]),children:l})};export{y as Price};
|
|
2
|
+
//# sourceMappingURL=Price.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Price.js","sources":["../../src/components/Price/Price.tsx"],"sourcesContent":["import { FunctionComponent } from 'preact';\nimport { HTMLAttributes, useMemo } from 'preact/compat';\nimport { classes } from '@adobe/elsie/lib';\nimport '@adobe/elsie/components/Price/Price.css';\n\nexport interface PriceProps\n extends Omit<HTMLAttributes<HTMLSpanElement>, 'size'> {\n amount?: number;\n currency?: string;\n locale?: string;\n formatOptions?: {\n [key: string]: any;\n };\n variant?: 'default' | 'strikethrough';\n weight?: 'bold' | 'normal';\n sale?: boolean;\n size?: 'small' | 'medium' | 'large';\n}\n\nexport const Price: FunctionComponent<PriceProps> = ({\n amount = 0,\n currency,\n locale = undefined,\n variant = 'default',\n weight = 'bold',\n className,\n children,\n sale = false,\n formatOptions = {},\n size = 'small',\n ...props\n}) => {\n const formatter = useMemo(\n () =>\n new Intl.NumberFormat(locale, {\n style: 'currency',\n currency: currency || 'USD',\n // These options are needed to round to whole numbers if that's what you want.\n minimumFractionDigits: 2, // (this suffices for whole numbers, but will print 2500.10 as $2,500.1)\n maximumFractionDigits: 2, // (causes 2500.99 to be printed as $2,501)\n ...formatOptions,\n }),\n [locale, currency, formatOptions]\n );\n\n const formattedAmount = useMemo(() => formatter.format(amount), [amount, formatter])\n\n return (\n <span\n {...props}\n className={classes([\n 'dropin-price',\n `dropin-price--${variant}`,\n `dropin-price--${size}`,\n `dropin-price--${weight}`,\n ['dropin-price--sale', sale],\n className,\n ])}\n >\n {formattedAmount}\n </span>\n );\n};\n"],"names":["Price","amount","currency","locale","undefined","variant","weight","className","children","sale","formatOptions","size","props","formatter","useMemo","Intl","NumberFormat","style","minimumFractionDigits","maximumFractionDigits","formattedAmount","format","_jsx","classes"],"mappings":"uPAmBO,MAAMA,EAAuCA,CAAC,CACnDC,OAAAA,EAAS,EACTC,SAAAA,EACAC,OAAAA,EAASC,OACTC,QAAAA,EAAU,UACVC,OAAAA,EAAS,OACTC,UAAAA,EACAC,SAAAA,EACAC,KAAAA,EAAO,GACPC,cAAAA,EAAgB,CAAC,EACjBC,KAAAA,EAAO,QACP,GAAGC,CACL,IAAM,CACJ,MAAMC,EAAYC,EAChB,IACE,IAAIC,KAAKC,aAAab,EAAQ,CAC5Bc,MAAO,WACPf,SAAUA,GAAY,MAEtBgB,sBAAuB,EACvBC,sBAAuB,EACvB,GAAGT,CACJ,CAAA,EACH,CAACP,EAAQD,EAAUQ,CAAa,CAClC,EAEMU,EAAkBN,EAAQ,IAAMD,EAAUQ,OAAOpB,CAAM,EAAG,CAACA,EAAQY,CAAS,CAAC,EAEnF,OACES,EAAA,OAAA,CAAA,GACMV,EACJL,UAAWgB,EAAQ,CACjB,eACC,iBAAgBlB,CAAQ,GACxB,iBAAgBM,CAAK,GACrB,iBAAgBL,CAAO,GACxB,CAAC,qBAAsBG,CAAI,EAC3BF,CAAS,CACV,EAAEC,SAEFY,CAAAA,CACG,CAEV"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"../preact-compat.js";import{c as i}from"../chunks/classes__DJBjVfEyCI.js";import"../chunks/image-params-keymap__LH6wjfp1fd.js";import{Fragment as _}from"../preact.js";import{jsx as r}from"../preact-jsx-runtime.js";import{Price as d}from"./Price.js";import{useText as D}from"../i18n.js";import{useMemo as b}from"../preact-hooks.js";const M=({className:p,children:l,locale:t,currency:a,amount:e,variant:o="default",minimumAmount:n,maximumAmount:s,size:f="small",display:h="dash",specialPrice:c,sale:g=!1,...w})=>{const R=b(()=>e||n===s||n&&!s||s&&!n,[e,s,n]);return r("div",{children:R?r("div",{...w,className:i(["dropin-price-range",p]),children:r(d,{amount:e??n??s,currency:a,locale:t,size:f,variant:o,sale:g})}):r("div",{...w,className:i(["dropin-price-range",p]),children:[h==="dash"?r(N,{specialPrice:c,minimumAmount:n,maximumAmount:s,currency:a,locale:t,size:f,sale:g}):null,h==="from to"?r(v,{specialPrice:c,minimumAmount:n,maximumAmount:s,currency:a,locale:t,size:f,sale:g}):null,h==="as low as"?r(L,{specialPrice:c,minimumAmount:n,maximumAmount:s,currency:a,locale:t,size:f,sale:g}):null]})})};function N({specialPrice:p,minimumAmount:l,maximumAmount:t,currency:a,locale:e,size:o,sale:n}){return r(_,{children:[r(d,{amount:p??l,currency:a,locale:e,size:o,sale:!!p&&n}),r("span",{className:"dropin-price-range__separator",children:"-"}),r(d,{amount:t,currency:a,locale:e,size:o})]})}function v({specialPrice:p,minimumAmount:l,maximumAmount:t,currency:a,locale:e,size:o,sale:n}){const s=D({from:"Dropin.PriceRange.from.label",to:"Dropin.PriceRange.to.label",asLowAs:"Dropin.PriceRange.asLowAs.label"});return r(_,{children:[r("span",{className:i(["dropin-price-range__from",`dropin-price-range__from--${o}`]),children:s.from}),r(d,{amount:p??l,currency:a,locale:e,size:o,sale:!!p&&n}),r("span",{className:i(["dropin-price-range__to",`dropin-price-range__to--${o}`]),children:s.to}),r(d,{amount:t,currency:a,locale:e,size:o})]})}function L({specialPrice:p,minimumAmount:l,maximumAmount:t,currency:a,locale:e,size:o,sale:n}){const s=D({from:"Dropin.PriceRange.from.label",to:"Dropin.PriceRange.to.label",asLowAs:"Dropin.PriceRange.asLowAs.label"});return r(_,{children:[r("span",{className:i(["dropin-price-range__as-low-as",`dropin-price-range__as-low-as--${o}`]),children:s.asLowAs}),p?r("div",{children:[r(d,{amount:t,currency:a,locale:e,size:o,variant:"strikethrough"}),r(d,{amount:p,currency:a,locale:e,size:o,className:"dropin-price-range__special",sale:!!p&&n})]}):r(d,{amount:l,currency:a,locale:e,size:o})]})}export{M as PriceRange,M as default};
|
|
2
|
+
//# sourceMappingURL=PriceRange.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PriceRange.js","sources":["../../src/components/PriceRange/PriceRange.tsx"],"sourcesContent":["import { FunctionComponent } from 'preact';\nimport { HTMLAttributes, useMemo } from 'preact/compat';\nimport { classes } from '@adobe/elsie/lib';\nimport '@adobe/elsie/components/PriceRange/PriceRange.css';\nimport { Price } from '@adobe/elsie/components/Price';\nimport { useText } from '@adobe/elsie/i18n';\n\nexport interface PriceRangeProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'size'> {\n locale?: string;\n currency?: string;\n amount?: number; // simple product\n variant?: 'default' | 'strikethrough';\n minimumAmount?: number; // configurable product\n maximumAmount?: number; // configurable product\n display?: 'dash' | 'from to' | 'as low as';\n size?: 'small' | 'medium' | 'large';\n specialPrice?: number;\n sale?: boolean;\n}\n\nexport const PriceRange: FunctionComponent<PriceRangeProps> = ({\n className,\n children,\n locale,\n currency,\n amount,\n variant = 'default',\n minimumAmount,\n maximumAmount,\n size = 'small',\n display = 'dash',\n specialPrice,\n sale = false,\n ...props\n}) => {\n const isSimpleProduct = useMemo(\n () =>\n amount ||\n minimumAmount === maximumAmount ||\n (minimumAmount && !maximumAmount) ||\n (maximumAmount && !minimumAmount),\n [amount, maximumAmount, minimumAmount]\n );\n\n return (\n <div>\n {/* Simple product price or when configurable product minimum price equals to maximum price */}\n {isSimpleProduct ? (\n <div {...props} className={classes(['dropin-price-range', className])}>\n <Price\n amount={amount ?? minimumAmount ?? maximumAmount}\n currency={currency}\n locale={locale}\n size={size}\n variant={variant}\n sale={sale}\n />\n </div>\n ) : (\n <div {...props} className={classes(['dropin-price-range', className])}>\n {display === 'dash' ? (\n <Dashed\n specialPrice={specialPrice}\n minimumAmount={minimumAmount}\n maximumAmount={maximumAmount}\n currency={currency}\n locale={locale}\n size={size}\n sale={sale}\n />\n ) : null}\n\n {display === 'from to' ? (\n <FromTo\n specialPrice={specialPrice}\n minimumAmount={minimumAmount}\n maximumAmount={maximumAmount}\n currency={currency}\n locale={locale}\n size={size}\n sale={sale}\n />\n ) : null}\n\n {display === 'as low as' ? (\n <SpecialPrice\n specialPrice={specialPrice}\n minimumAmount={minimumAmount}\n maximumAmount={maximumAmount}\n currency={currency}\n locale={locale}\n size={size}\n sale={sale}\n />\n ) : null}\n </div>\n )}\n </div>\n );\n};\n\n// Variations\n\nfunction Dashed({\n specialPrice,\n minimumAmount,\n maximumAmount,\n currency,\n locale,\n size,\n sale,\n}: PriceRangeProps) {\n return (\n <>\n <Price\n amount={specialPrice ?? minimumAmount}\n currency={currency}\n locale={locale}\n size={size}\n sale={!!specialPrice && sale}\n />\n <span className=\"dropin-price-range__separator\">-</span>\n <Price\n amount={maximumAmount}\n currency={currency}\n locale={locale}\n size={size}\n />\n </>\n );\n}\n\nfunction FromTo({\n specialPrice,\n minimumAmount,\n maximumAmount,\n currency,\n locale,\n size,\n sale,\n}: PriceRangeProps) {\n // Translations\n const translations = useText({\n from: 'Dropin.PriceRange.from.label',\n to: 'Dropin.PriceRange.to.label',\n asLowAs: 'Dropin.PriceRange.asLowAs.label',\n });\n\n return (\n <>\n <span\n className={classes([\n 'dropin-price-range__from',\n `dropin-price-range__from--${size}`,\n ])}\n >\n {translations.from}\n </span>\n <Price\n amount={specialPrice ?? minimumAmount}\n currency={currency}\n locale={locale}\n size={size}\n sale={!!specialPrice && sale}\n />\n <span\n className={classes([\n 'dropin-price-range__to',\n `dropin-price-range__to--${size}`,\n ])}\n >\n {translations.to}\n </span>\n <Price\n amount={maximumAmount}\n currency={currency}\n locale={locale}\n size={size}\n />\n </>\n );\n}\n\nfunction SpecialPrice({\n specialPrice,\n minimumAmount,\n maximumAmount,\n currency,\n locale,\n size,\n sale,\n}: PriceRangeProps) {\n // Translations\n const translations = useText({\n from: 'Dropin.PriceRange.from.label',\n to: 'Dropin.PriceRange.to.label',\n asLowAs: 'Dropin.PriceRange.asLowAs.label',\n });\n\n return (\n <>\n <span\n className={classes([\n 'dropin-price-range__as-low-as',\n `dropin-price-range__as-low-as--${size}`,\n ])}\n >\n {translations.asLowAs}\n </span>\n {specialPrice ? (\n <div>\n <Price\n amount={maximumAmount}\n currency={currency}\n locale={locale}\n size={size}\n variant=\"strikethrough\"\n />\n <Price\n amount={specialPrice}\n currency={currency}\n locale={locale}\n size={size}\n className=\"dropin-price-range__special\"\n sale={!!specialPrice && sale}\n />\n </div>\n ) : (\n <Price\n amount={minimumAmount}\n currency={currency}\n locale={locale}\n size={size}\n />\n )}\n </>\n );\n}\n"],"names":["PriceRange","className","children","locale","currency","amount","variant","minimumAmount","maximumAmount","size","display","specialPrice","sale","props","isSimpleProduct","useMemo","_jsx","classes","Price","_jsxs","Dashed","FromTo","SpecialPrice","_Fragment","translations","useText","from","to","asLowAs"],"mappings":"kVAqBO,MAAMA,EAAiDA,CAAC,CAC7DC,UAAAA,EACAC,SAAAA,EACAC,OAAAA,EACAC,SAAAA,EACAC,OAAAA,EACAC,QAAAA,EAAU,UACVC,cAAAA,EACAC,cAAAA,EACAC,KAAAA,EAAO,QACPC,QAAAA,EAAU,OACVC,aAAAA,EACAC,KAAAA,EAAO,GACP,GAAGC,CACL,IAAM,CACJ,MAAMC,EAAkBC,EACtB,IACEV,GACAE,IAAkBC,GACjBD,GAAiB,CAACC,GAClBA,GAAiB,CAACD,EACrB,CAACF,EAAQG,EAAeD,CAAa,CACvC,EAEA,OACES,EAAA,MAAA,CAAAd,SAEGY,EACCE,EAAA,MAAA,CAAA,GAASH,EAAOZ,UAAWgB,EAAQ,CAAC,qBAAsBhB,CAAS,CAAC,EAAEC,SACpEc,EAACE,EAAK,CACJb,OAAQA,GAAUE,GAAiBC,EACnCJ,SAAAA,EACAD,OAAAA,EACAM,KAAAA,EACAH,QAAAA,EACAM,KAAAA,CAAAA,CACD,CAAA,CACE,EAELO,EAAA,MAAA,CAAA,GAASN,EAAOZ,UAAWgB,EAAQ,CAAC,qBAAsBhB,CAAS,CAAC,EAAEC,UACnEQ,IAAY,OACXM,EAACI,EAAM,CACLT,aAAAA,EACAJ,cAAAA,EACAC,cAAAA,EACAJ,SAAAA,EACAD,OAAAA,EACAM,KAAAA,EACAG,KAAAA,CACD,CAAA,EACC,KAEHF,IA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AAAA,CACzB,EACDI,EAAA,OAAA,CACEf,UAAWgB,EAAQ,CACjB,yBACC,2BAA0BR,CAAK,EAAC,CAClC,EAAEP,SAEFsB,EAAaG,EAAAA,CACV,EACNX,EAACE,EAAK,CACJb,OAAQG,EACRJ,SAAAA,EACAD,OAAAA,EACAM,KAAAA,CAAAA,CACD,CAAC,CAAA,CACF,CAEN,CAEA,SAASa,EAAa,CACpBX,aAAAA,EACAJ,cAAAA,EACAC,cAAAA,EACAJ,SAAAA,EACAD,OAAAA,EACAM,KAAAA,EACAG,KAAAA,CACe,EAAG,CAElB,MAAMY,EAAeC,EAAQ,CAC3BC,KAAM,+BACNC,GAAI,6BACJC,QAAS,iCAAA,CACV,EAED,OACET,EAAAI,EAAA,CAAArB,UACEc,EAAA,OAAA,CACEf,UAAWgB,EAAQ,CACjB,gCACC,kCAAiCR,CAAK,EAAC,CACzC,EAAEP,SAEFsB,EAAaI,OAAAA,CACV,EACLjB,EACCQ,EAAA,MAAA,CAAAjB,SAAA,CACEc,EAACE,EAAK,CACJb,OAAQG,EACRJ,SAAAA,EACAD,OAAAA,EACAM,KAAAA,EACAH,QAAQ,eAAA,CACT,EACDU,EAACE,EAAK,CACJb,OAAQM,EACRP,SAAAA,EACAD,OAAAA,EACAM,KAAAA,EACAR,UAAU,8BACVW,KAAM,CAAC,CAACD,GAAgBC,CAAAA,CACzB,CAAC,CAAA,CACC,EAELI,EAACE,EAAK,CACJb,OAAQE,EACRH,SAAAA,EACAD,OAAAA,EACAM,KAAAA,CAAAA,CACD,CACF,CAAA,CACD,CAEN"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"../preact-compat.js";import{c as e}from"../chunks/classes__DJBjVfEyCI.js";import"../chunks/image-params-keymap__LH6wjfp1fd.js";import{Fragment as s}from"../preact.js";import{jsx as i}from"../preact-jsx-runtime.js";import{V as n}from"../chunks/vcomponent__BjnR-FRhjl.js";import{useText as j,Text as t}from"../i18n.js";import G from"../chunks/ChevronDown__BQ2yC5Yu4N.js";import Z from"../chunks/ChevronUp__DKfBFRUuWH.js";import K,{AccordionSection as U}from"./Accordion.js";import{useState as u,useRef as q}from"../preact-hooks.js";import{SkeletonRow as H,Skeleton as J}from"./Skeleton.js";import M from"./Divider.js";import"../chunks/Add__CiEO_sX7HP.js";import"../chunks/Minus__CefO5Dkv_0.js";import"./Icon.js";const Q=c=>{const _=new FormData(c);return Object.fromEntries(_)},ui=({className:c,children:_,...y})=>{const{heading:f,loading:k=!0,total:o,subTotal:m,shipping:r,taxTotal:p,taxesApplied:h,discounts:x,primaryAction:b,...v}=y,[w,P]=u(!1),N=q(null),[C,l]=u(!0),[g,F]=u("zip"),D=j({editZipAction:"Dropin.PriceSummary.shipping.editZipAction",destinationLinkAriaLabel:"Dropin.PriceSummary.shipping.destinationLinkAriaLabel",taxesBreakdownTitle:"Dropin.PriceSummary.taxes.breakdown",subtotalLabel:"Dropin.PriceSummary.subTotal.label",shippingLabel:"Dropin.PriceSummary.shipping.label",showTaxBreakdown:"Dropin.PriceSummary.taxes.showBreakdown",hideTaxBreakdown:"Dropin.PriceSummary.taxes.hideBreakdown",zipPlaceholder:"Dropin.PriceSummary.shipping.zipPlaceholder"}),S=a=>{a.preventDefault(),l(d=>!d)},A=a=>{a.preventDefault(),l(!0),F(d=>d==="zip"?"state":"zip")},E=a=>{var T;a.preventDefault(),l(!1);const d=Q(N.current);(T=r==null?void 0:r.onEstimate)==null||T.call(r,d)},z=i(J,{"data-testid":"loading-skeleton",rowGap:"xsmall",children:i(H,{variant:"row",size:"small",lines:5,fullWidth:!0,multilineGap:"xsmall"})}),L=r&&i(s,{children:i("div",{"data-testid":"shipping-content",className:e(["dropin-price-summary__entry","dropin-price-summary__shipping"]),children:[i("span",{className:"dropin-price-summary__label",children:r.estimated?r.destinationText?i(s,{children:[i(t,{id:"Dropin.PriceSummary.shipping.estimatedDestination"}),i("a",{className:"dropin-price-summary__shippingLink",role:"button",href:"",onClick:S,onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&S(a)},tabIndex:0,"aria-label":D.destinationLinkAriaLabel,"data-testid":"shipping-destination-link",children:r.destinationText})]}):i(t,{id:"Dropin.PriceSummary.shipping.estimated"}):i(t,{id:"Dropin.PriceSummary.shipping.label"})}),i(n,{node:r.price,className:"dropin-price-summary__price"}),r.estimated&&i(s,{children:i("div",{className:e(["dropin-price-summary__caption"]),children:i("a",{href:"#",className:"dropin-price-summary__shippingLink",onClick:A,"data-testid":"shipping-alternate-field-link",children:g==="zip"?i(t,{id:"Dropin.PriceSummary.shipping.alternateField.state"}):i(t,{id:"Dropin.PriceSummary.shipping.alternateField.zip"})})})}),r.estimated&&i(s,{children:i("form",{className:e(["dropin-price-summary__shipping--edit",["dropin-price-summary__shipping--hide",!C]]),ref:N,"data-testid":"shipping-estimate-form",children:[r.countryField&&i(n,{node:r.countryField,className:e(["dropin-price-summary__shipping--country"])}),g==="state"?r.stateField&&i(n,{node:r.stateField,className:e(["dropin-price-summary__shipping--state"])}):r.zipField&&i(n,{node:r.zipField,className:e(["dropin-price-summary__shipping--zip"])}),r.estimateButton&&i(n,{node:r.estimateButton,className:e(["dropin-price-summary__shipping--action"]),onClick:E,type:"submit"})]})}),r.taxIncluded&&i("div",{"data-testid":"shipping-tax-included",className:e(["dropin-price-summary__caption"]),children:i("span",{children:i(t,{id:"Dropin.PriceSummary.shipping.withTaxes"})})}),r.taxExcluded?i("div",{"data-testid":"shipping-tax-included-excluded",className:e(["dropin-price-summary__caption"]),children:i("span",{children:[r.priceExcludingTax," ",i(t,{id:"Dropin.PriceSummary.shipping.withoutTaxes"})]})}):void 0]})}),B=x&&i(s,{children:x.map(a=>i("div",{className:e(["dropin-price-summary__entry","dropin-price-summary__discount"]),children:[i("span",{className:e(["dropin-price-summary__label"]),children:a.label}),i(n,{node:a.price,className:e(["dropin-price-summary__price"])}),a.caption&&i(n,{node:a.caption,className:e(["dropin-price-summary__caption"])})]},a.label))}),W=h?i(s,{children:i(K,{"data-testid":"tax-breakdown",className:"dropin-price-summary__taxes",iconOpen:G,iconClose:Z,children:i(U,{title:D.taxesBreakdownTitle,secondaryText:!w&&p?i(n,{node:p.price,className:"dropin-price-summary__price"}):void 0,renderContentWhenClosed:!1,onStateChange:P,children:[i("div",{className:e(["dropin-price-summary__appliedTaxes"]),children:h.map(a=>i("div",{className:e(["dropin-price-summary__entry","dropin-price-summary__taxEntry"]),children:[i("span",{className:e(["dropin-price-summary__label","dropin-price-summary__label--muted"]),children:a.label}),i(n,{node:a.price,className:e(["dropin-price-summary__price","dropin-price-summary__price--muted"])})]},a.label))}),i("div",{className:e(["dropin-price-summary__entry"]),children:[i("span",{className:"dropin-price-summary__label",children:i(t,{id:"Dropin.PriceSummary.taxes.total"})}),p&&i(n,{node:p.price,className:"dropin-price-summary__price"})]})]})})}):p&&i("div",{"data-testid":"tax-total-only",className:e(["dropin-price-summary__entry","dropin-price-summary__taxTotal"]),children:[i("span",{className:"dropin-price-summary__label",children:p.estimated?i(t,{id:"Dropin.PriceSummary.taxes.estimated"}):i(t,{id:"Dropin.PriceSummary.taxes.totalOnly"})}),i(n,{node:p.price,className:"dropin-price-summary__price"})]}),I=o&&i(s,{children:i("div",{"data-testid":"total-content",className:e(["dropin-price-summary__entry","dropin-price-summary__total",o.estimated&&"dropin-price-summary__total--padded"]),children:[i("span",{className:e(["dropin-price-summary__label","dropin-price-summary__label--bold"]),children:o.estimated?i(t,{id:"Dropin.PriceSummary.total.estimated"}):i(t,{id:"Dropin.PriceSummary.total.label"})}),i(n,{node:o.price,className:e(["dropin-price-summary__price","dropin-price-summary__price--bold"])})]})}),O=o&&o.priceWithoutTax&&i("div",{"data-testid":"total-without-tax",className:"dropin-price-summary__entry dropin-price-summary__totalWithoutTax",children:[i("span",{className:e(["dropin-price-summary__label","dropin-price-summary__label--muted"]),children:i(t,{id:"Dropin.PriceSummary.total.withoutTax"})}),i(n,{node:o.priceWithoutTax,className:e(["dropin-price-summary__price","dropin-price-summary__price--muted"])})]}),R=b&&i("div",{className:e(["dropin-price-summary__entry","dropin-price-summary__primaryAction"]),children:b}),V=m&&i("div",{className:e(["dropin-price-summary__entry","dropin-price-summary__subTotal"]),children:[i("span",{className:"dropin-price-summary__label",children:i(t,{id:"Dropin.PriceSummary.subTotal.label"})}),i(n,{node:m.price,className:"dropin-price-summary__price"}),m.taxIncluded&&i("div",{"data-testid":"sub-total-tax-caption",className:e(["dropin-price-summary__caption"]),children:i("span",{children:i(t,{id:"Dropin.PriceSummary.subTotal.withTaxes"})})}),m.taxExcluded?i("div",{"data-testid":"sub-total-tax-caption-excluded",className:e(["dropin-price-summary__caption"]),children:i("span",{children:[m.priceExcludingTax," ",i(t,{id:"Dropin.PriceSummary.subTotal.withoutTaxes"})]})}):void 0]});return i("div",{...v,className:e(["dropin-price-summary",c]),children:[i("div",{className:"dropin-price-summary__heading",children:f}),i(M,{variant:"primary",className:"dropin-price-summary__divider-primary"}),k?z:i(s,{children:[V,L,B,W,I,O,R]})]})};export{ui as PriceSummary,ui as default};
|
|
2
|
+
//# sourceMappingURL=PriceSummary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PriceSummary.js","sources":["../../src/lib/form-values.ts","../../src/components/PriceSummary/PriceSummary.tsx"],"sourcesContent":["export const getFormValues = (form: HTMLFormElement) => {\n const formData: any = new FormData(form);\n const result = Object.fromEntries(formData);\n return result;\n};\n\nexport const getFormErrors = (form: HTMLFormElement) => {\n const formData: any = new FormData(form);\n\n const data = Object.fromEntries(formData);\n\n const result = Object.entries(data).reduce((result, [key]) => {\n // @ts-ignore\n const field = form.elements[key];\n\n return field?.validationMessage\n ? { ...result, [key]: field.validationMessage }\n : { ...result };\n }, {});\n\n return result;\n};\n","import { FunctionComponent, VNode } from 'preact';\nimport { HTMLAttributes, useRef, useState } from 'preact/compat';\nimport { VComponent, classes, getFormValues } from '@adobe/elsie/lib';\nimport { Text, useText } from '@adobe/elsie/i18n';\nimport {\n Accordion,\n AccordionSection,\n Divider,\n Skeleton,\n SkeletonRow,\n} from '@adobe/elsie/components';\n\nimport { ChevronDown, ChevronUp } from '@adobe/elsie/icons';\n\nimport '@adobe/elsie/components/PriceSummary/PriceSummary.css';\n\nexport interface PriceSummaryProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'loading'> {\n heading: string;\n loading?: boolean;\n total?: {\n price: VNode<HTMLAttributes<HTMLSpanElement>>;\n estimated?: boolean;\n priceWithoutTax?: VNode<HTMLAttributes<HTMLSpanElement>>;\n };\n subTotal?: {\n price: VNode<HTMLAttributes<HTMLSpanElement>>;\n priceExcludingTax?: VNode<HTMLAttributes<HTMLSpanElement>>;\n taxIncluded?: boolean;\n taxExcluded?: boolean;\n zeroTaxSubtotal?: boolean;\n };\n shipping?: {\n price: VNode<HTMLAttributes<HTMLSpanElement>>;\n estimated?: boolean;\n taxIncluded?: boolean;\n taxExcluded?: boolean;\n priceIncludingTax?: VNode<HTMLAttributes<HTMLSpanElement>>;\n priceExcludingTax?: VNode<HTMLAttributes<HTMLSpanElement>>;\n countryField?: VNode<HTMLAttributes<HTMLInputElement>>;\n stateField?: VNode<HTMLAttributes<HTMLInputElement>>;\n zipField?: VNode<HTMLAttributes<HTMLInputElement>>;\n destinationText?: string;\n onEstimate?: (formData: any) => void;\n estimateButton?: VNode<HTMLAttributes<HTMLButtonElement>>;\n };\n taxTotal?: {\n price: VNode<HTMLAttributes<HTMLSpanElement>>;\n estimated?: boolean;\n };\n taxesApplied?: {\n label: string;\n price: VNode<HTMLAttributes<HTMLSpanElement>>;\n }[];\n discounts?: {\n label: string;\n price: VNode<HTMLAttributes<HTMLSpanElement>>;\n caption?: VNode<HTMLAttributes<HTMLDivElement>>;\n }[];\n primaryAction?: VNode<HTMLAttributes<HTMLButtonElement>>;\n}\n\nexport const PriceSummary: FunctionComponent<PriceSummaryProps> = ({\n className,\n children,\n ...props\n}) => {\n const {\n heading,\n loading = true,\n total,\n subTotal,\n shipping,\n taxTotal,\n taxesApplied,\n discounts,\n primaryAction,\n ...restProps\n } = props;\n\n const [showTaxBreakdown, setShowTaxBreakdown] = useState(false);\n\n const estimateFormRef = useRef<HTMLFormElement>(null);\n const [showEstimateForm, setShowEstimateForm] = useState(true);\n const [estimateField, setEstimateField] = useState<'zip' | 'state'>('zip');\n\n const translations = useText({\n editZipAction: 'Dropin.PriceSummary.shipping.editZipAction',\n destinationLinkAriaLabel:\n 'Dropin.PriceSummary.shipping.destinationLinkAriaLabel',\n taxesBreakdownTitle: 'Dropin.PriceSummary.taxes.breakdown',\n subtotalLabel: 'Dropin.PriceSummary.subTotal.label',\n shippingLabel: 'Dropin.PriceSummary.shipping.label',\n showTaxBreakdown: 'Dropin.PriceSummary.taxes.showBreakdown',\n hideTaxBreakdown: 'Dropin.PriceSummary.taxes.hideBreakdown',\n zipPlaceholder: 'Dropin.PriceSummary.shipping.zipPlaceholder',\n });\n\n const onDestinationLinkClick = (e: Event) => {\n e.preventDefault();\n setShowEstimateForm((show) => !show);\n };\n\n const onAlternateFieldClick = (e: Event) => {\n e.preventDefault();\n setShowEstimateForm(true);\n\n setEstimateField((field) => (field === 'zip' ? 'state' : 'zip'));\n };\n\n const onSubmitEstimate = (e: Event) => {\n e.preventDefault();\n setShowEstimateForm(false);\n\n const formData = getFormValues(estimateFormRef.current!);\n\n shipping?.onEstimate?.(formData);\n };\n\n // Skeleton content to show while loading\n const skeletonContent = (\n <Skeleton data-testid=\"loading-skeleton\" rowGap=\"xsmall\">\n <SkeletonRow\n variant=\"row\"\n size=\"small\"\n lines={5}\n fullWidth={true}\n multilineGap=\"xsmall\"\n />\n </Skeleton>\n );\n\n // Entry for the shipping price\n const shippingContent = shipping && (\n <>\n <div\n data-testid=\"shipping-content\"\n className={classes([\n 'dropin-price-summary__entry',\n 'dropin-price-summary__shipping',\n ])}\n >\n <span className={'dropin-price-summary__label'}>\n {shipping.estimated ? (\n shipping.destinationText ? (\n <>\n <Text id=\"Dropin.PriceSummary.shipping.estimatedDestination\" />\n <a\n className={'dropin-price-summary__shippingLink'}\n role=\"button\"\n href=\"\"\n onClick={onDestinationLinkClick}\n onKeyDown={(event) => {\n if (event.key === 'Enter' || event.key === ' ') {\n onDestinationLinkClick(event);\n }\n }}\n tabIndex={0}\n aria-label={translations.destinationLinkAriaLabel}\n data-testid=\"shipping-destination-link\"\n >\n {shipping.destinationText}\n </a>\n </>\n ) : (\n <Text id=\"Dropin.PriceSummary.shipping.estimated\" />\n )\n ) : (\n <Text id=\"Dropin.PriceSummary.shipping.label\" />\n )}\n </span>\n <VComponent\n node={shipping.price}\n className={'dropin-price-summary__price'}\n />\n\n {shipping.estimated && (\n <>\n <div className={classes(['dropin-price-summary__caption'])}>\n <a\n href=\"#\"\n className={'dropin-price-summary__shippingLink'}\n onClick={onAlternateFieldClick}\n data-testid=\"shipping-alternate-field-link\"\n >\n {estimateField === 'zip' ? (\n <Text id=\"Dropin.PriceSummary.shipping.alternateField.state\" />\n ) : (\n <Text id=\"Dropin.PriceSummary.shipping.alternateField.zip\" />\n )}\n </a>\n </div>\n </>\n )}\n\n {/* Edit shipping address form */}\n {shipping.estimated && (\n <>\n <form\n className={classes([\n 'dropin-price-summary__shipping--edit',\n ['dropin-price-summary__shipping--hide', !showEstimateForm],\n ])}\n ref={estimateFormRef}\n data-testid=\"shipping-estimate-form\"\n >\n {shipping.countryField && (\n <VComponent\n node={shipping.countryField}\n className={classes([\n 'dropin-price-summary__shipping--country',\n ])}\n />\n )}\n {estimateField === 'state'\n ? shipping.stateField && (\n <VComponent\n node={shipping.stateField}\n className={classes([\n 'dropin-price-summary__shipping--state',\n ])}\n />\n )\n : shipping.zipField && (\n <VComponent\n node={shipping.zipField}\n className={classes([\n 'dropin-price-summary__shipping--zip',\n ])}\n />\n )}\n {shipping.estimateButton && (\n <VComponent\n node={shipping.estimateButton}\n className={classes([\n 'dropin-price-summary__shipping--action',\n ])}\n onClick={onSubmitEstimate}\n type=\"submit\"\n />\n )}\n </form>\n </>\n )}\n\n {shipping.taxIncluded && (\n <div\n data-testid=\"shipping-tax-included\"\n className={classes(['dropin-price-summary__caption'])}\n >\n <span>\n <Text id=\"Dropin.PriceSummary.shipping.withTaxes\" />\n </span>\n </div>\n )}\n\n {shipping.taxExcluded ? (\n <div\n data-testid=\"shipping-tax-included-excluded\"\n className={classes(['dropin-price-summary__caption'])}\n >\n <span>\n {shipping.priceExcludingTax}{' '}\n <Text id=\"Dropin.PriceSummary.shipping.withoutTaxes\" />\n </span>\n </div>\n ) : undefined}\n </div>\n </>\n );\n\n // Entry for the discounts\n const discountContent = discounts && (\n <>\n {discounts.map((discount) => (\n <div\n className={classes([\n 'dropin-price-summary__entry',\n 'dropin-price-summary__discount',\n ])}\n key={discount.label}\n >\n <span className={classes(['dropin-price-summary__label'])}>\n {discount.label}\n </span>\n <VComponent\n node={discount.price}\n className={classes(['dropin-price-summary__price'])}\n />\n {discount.caption && (\n <VComponent\n node={discount.caption}\n className={classes(['dropin-price-summary__caption'])}\n />\n )}\n </div>\n ))}\n </>\n );\n\n // Entry for the total tax and breakdown (if provided)\n const taxContent = taxesApplied ? (\n /* Show breakdown if provided */\n <>\n <Accordion\n data-testid=\"tax-breakdown\"\n className={'dropin-price-summary__taxes'}\n iconOpen={ChevronDown}\n iconClose={ChevronUp}\n >\n <AccordionSection\n title={translations.taxesBreakdownTitle}\n secondaryText={\n !showTaxBreakdown && taxTotal ? (\n <VComponent\n node={taxTotal.price}\n className={'dropin-price-summary__price'}\n />\n ) : undefined\n }\n renderContentWhenClosed={false}\n onStateChange={setShowTaxBreakdown}\n >\n <div className={classes(['dropin-price-summary__appliedTaxes'])}>\n {taxesApplied.map((tax) => (\n <div\n className={classes([\n 'dropin-price-summary__entry',\n 'dropin-price-summary__taxEntry',\n ])}\n key={tax.label}\n >\n <span\n className={classes([\n 'dropin-price-summary__label',\n 'dropin-price-summary__label--muted',\n ])}\n >\n {tax.label}\n </span>\n\n <VComponent\n node={tax.price}\n className={classes([\n 'dropin-price-summary__price',\n 'dropin-price-summary__price--muted',\n ])}\n />\n </div>\n ))}\n </div>\n\n <div className={classes(['dropin-price-summary__entry'])}>\n <span className={'dropin-price-summary__label'}>\n <Text id=\"Dropin.PriceSummary.taxes.total\" />\n </span>\n {taxTotal && (\n <VComponent\n node={taxTotal.price}\n className={'dropin-price-summary__price'}\n />\n )}\n </div>\n </AccordionSection>\n </Accordion>\n </>\n ) : (\n taxTotal && (\n /* Otherwise, show total only */\n <div\n data-testid=\"tax-total-only\"\n className={classes([\n 'dropin-price-summary__entry',\n 'dropin-price-summary__taxTotal',\n ])}\n >\n <span className={'dropin-price-summary__label'}>\n {taxTotal.estimated ? (\n <Text id=\"Dropin.PriceSummary.taxes.estimated\" />\n ) : (\n <Text id=\"Dropin.PriceSummary.taxes.totalOnly\" />\n )}\n </span>\n <VComponent\n node={taxTotal.price}\n className={'dropin-price-summary__price'}\n />\n </div>\n )\n );\n\n // Entry for the total\n const totalContent = total && (\n <>\n <div\n data-testid=\"total-content\"\n className={classes([\n 'dropin-price-summary__entry',\n 'dropin-price-summary__total',\n total.estimated && 'dropin-price-summary__total--padded',\n ])}\n >\n <span\n className={classes([\n 'dropin-price-summary__label',\n 'dropin-price-summary__label--bold',\n ])}\n >\n {total.estimated ? (\n <Text id=\"Dropin.PriceSummary.total.estimated\" />\n ) : (\n <Text id=\"Dropin.PriceSummary.total.label\" />\n )}\n </span>\n <VComponent\n node={total.price}\n className={classes([\n 'dropin-price-summary__price',\n 'dropin-price-summary__price--bold',\n ])}\n />\n </div>\n </>\n );\n\n // Entry for the total without tax\n const totalWithoutTaxContent = total && total.priceWithoutTax && (\n <div\n data-testid=\"total-without-tax\"\n className={\n 'dropin-price-summary__entry dropin-price-summary__totalWithoutTax'\n }\n >\n <span\n className={classes([\n 'dropin-price-summary__label',\n 'dropin-price-summary__label--muted',\n ])}\n >\n <Text id=\"Dropin.PriceSummary.total.withoutTax\" />\n </span>\n <VComponent\n node={total.priceWithoutTax}\n className={classes([\n 'dropin-price-summary__price',\n 'dropin-price-summary__price--muted',\n ])}\n />\n </div>\n );\n\n // Entry for the primary action\n const primaryActionContent = primaryAction && (\n <div\n className={classes([\n 'dropin-price-summary__entry',\n 'dropin-price-summary__primaryAction',\n ])}\n >\n {primaryAction}\n </div>\n );\n\n const subTotalContent = subTotal && (\n <div\n className={classes([\n 'dropin-price-summary__entry',\n 'dropin-price-summary__subTotal',\n ])}\n >\n <span className={'dropin-price-summary__label'}>\n <Text id=\"Dropin.PriceSummary.subTotal.label\" />\n </span>\n <VComponent\n node={subTotal.price}\n className={'dropin-price-summary__price'}\n />\n {subTotal.taxIncluded && (\n <div\n data-testid=\"sub-total-tax-caption\"\n className={classes(['dropin-price-summary__caption'])}\n >\n <span>\n <Text id=\"Dropin.PriceSummary.subTotal.withTaxes\" />\n </span>\n </div>\n )}\n\n {subTotal.taxExcluded ? (\n <div\n data-testid=\"sub-total-tax-caption-excluded\"\n className={classes(['dropin-price-summary__caption'])}\n >\n <span>\n {subTotal.priceExcludingTax}\n \n <Text id=\"Dropin.PriceSummary.subTotal.withoutTaxes\" />\n </span>\n </div>\n ) : undefined}\n </div>\n );\n return (\n <div\n {...restProps}\n className={classes(['dropin-price-summary', className])}\n >\n <div className={'dropin-price-summary__heading'}>{heading}</div>\n\n <Divider\n variant=\"primary\"\n className={'dropin-price-summary__divider-primary'}\n />\n\n {loading ? (\n skeletonContent\n ) : (\n <>\n {subTotalContent}\n\n {shippingContent}\n\n {discountContent}\n\n {taxContent}\n\n {totalContent}\n\n {totalWithoutTaxContent}\n\n {primaryActionContent}\n </>\n )}\n </div>\n );\n};\n"],"names":["getFormValues","form","formData","FormData","result","Object","fromEntries","PriceSummary","className","children","props","heading","loading","total","subTotal","shipping","taxTotal","taxesApplied","discounts","primaryAction","restProps","showTaxBreakdown","setShowTaxBreakdown","useState","estimateFormRef","useRef","showEstimateForm","setShowEstimateForm","estimateField","setEstimateField","translations","useText","editZipAction","destinationLinkAriaLabel","taxesBreakdownTitle","subtotalLabel","shippingLabel","hideTaxBreakdown","zipPlaceholder","onDestinationLinkClick","e","preventDefault","show","onAlternateFieldClick","field","onSubmitEstimate","current","onEstimate","skeletonContent","_jsx","Skeleton","rowGap","SkeletonRow","variant","size","lines","fullWidth","multilineGap","shippingContent","_Fragment","_jsxs","classes","estimated","destinationText","Text","id","role","href","onClick","onKeyDown","event","key","tabIndex","VComponent","node","price","ref","countryField","stateField","zipField","estimateButton","type","taxIncluded","taxExcluded","priceExcludingTax","undefined","discountContent","map","discount","label","caption","taxContent","Accordion","iconOpen","ChevronDown","iconClose","ChevronUp","AccordionSection","title","secondaryText","renderContentWhenClosed","onStateChange","tax","totalContent","totalWithoutTaxContent","priceWithoutTax","primaryActionContent","subTotalContent","Divider"],"mappings":"6sBAAaA,MAAAA,EAAiBC,GAA0B,CAChDC,MAAAA,EAAgB,IAAIC,SAASF,CAAI,EAEhCG,OADQC,OAAOC,YAAYJ,CAAQ,CAE5C,EC0DaK,GAAqDA,CAAC,CACjEC,UAAAA,EACAC,SAAAA,EACA,GAAGC,CACL,IAAM,CACE,KAAA,CACJC,QAAAA,EACAC,QAAAA,EAAU,GACVC,MAAAA,EACAC,SAAAA,EACAC,SAAAA,EACAC,SAAAA,EACAC,aAAAA,EACAC,UAAAA,EACAC,cAAAA,EACA,GAAGC,CACDV,EAAAA,EAEE,CAACW,EAAkBC,CAAmB,EAAIC,EAAS,EAAK,EAExDC,EAAkBC,EAAwB,IAAI,EAC9C,CAACC,EAAkBC,CAAmB,EAAIJ,EAAS,EAAI,EACvD,CAACK,EAAeC,CAAgB,EAAIN,EAA0B,KAAK,EAEnEO,EAAeC,EAAQ,CAC3BC,cAAe,6CACfC,yBACE,wDACFC,oBAAqB,sCACrBC,cAAe,qCACfC,cAAe,qCACff,iBAAkB,0CAClBgB,iBAAkB,0CAClBC,eAAgB,6CAAA,CACjB,EAEKC,EAA0BC,GAAa,CAC3CA,EAAEC,eAAe,EACIC,EAAAA,GAAS,CAACA,CAAI,CAAA,EAG/BC,EAAyBH,GAAa,CAC1CA,EAAEC,eAAe,EAC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,CACGK,EAASsE,kBAAkB,IAE5BnC,EAACe,EAAI,CAACC,GAAG,2CAAA,CAA6C,CAAC,CAAA,CACnD,CAAA,CACH,EACHoB,MAAS,CAAA,CACV,EAEP,OACEzB,EAAA,MAAA,CAAA,GACMxC,EACJZ,UAAWqD,EAAQ,CAAC,uBAAwBrD,CAAS,CAAC,EAAEC,UAExDwC,EAAA,MAAA,CAAKzC,UAAW,gCAAgCC,SAAEE,CAAAA,CAAa,EAE/DsC,EAAC2D,EAAO,CACNvD,QAAQ,UACR7C,UAAW,uCACZ,CAAA,EAEAI,EACCoC,EAEAY,EAAAD,EAAA,CAAAlD,SACGkG,CAAAA,EAEAjD,EAEA4B,EAEAK,EAEAY,EAEAC,EAEAE,CAAoB,CAAA,CACrB,CACH,CAAA,CACE,CAET"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{c as s}from"../chunks/classes__DJBjVfEyCI.js";import"../chunks/image-params-keymap__LH6wjfp1fd.js";import"../preact.js";import{jsx as r}from"../preact-jsx-runtime.js";import{useText as g}from"../i18n.js";import"../preact-hooks.js";const C=({ariaLabel:i,size:d="small",stroke:l="4",children:e,className:n,style:u,...a})=>{const o=["dropin-progress-spinner",`dropin-progress-spinner--shape-size-${d}`,`dropin-progress-spinner--shape-stroke-${l}`],p=g({updating:"Dropin.ProgressSpinner.updating.label",updatingChildren:"Dropin.ProgressSpinner.updatingChildren.label"}),t=()=>i||(e?p.updatingChildren:p.updating);return e?r("div",{...a,className:s(["dropin-progress-spinner-provider"]),"aria-live":"polite",role:"status",children:[r("div",{"aria-hidden":!0,children:e}),r("div",{"aria-label":t(),role:"status",className:s(["dropin-progress-spinner-background",n]),style:u}),r("div",{className:s(["dropin-progress-spinner-with-provider",...o]),"aria-hidden":!0})]}):r("div",{...a,className:s([n,...o]),"aria-live":"polite",role:"status","aria-label":t()})};export{C as ProgressSpinner,C as default};
|
|
2
|
+
//# sourceMappingURL=ProgressSpinner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProgressSpinner.js","sources":["../../src/components/ProgressSpinner/ProgressSpinner.tsx"],"sourcesContent":["import { FunctionComponent } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { useText } from '@adobe/elsie/i18n';\nimport { classes } from '@adobe/elsie/lib';\n\nimport '@adobe/elsie/components/ProgressSpinner/ProgressSpinner.css';\n\n/**\n * @param size this is the size of the spinner ranging in [12px, 24px, 36px, 48px]\n * @param stroke this is the stroke of the spinner ranging in [1px, 2px, 3px, 4px]\n */\nexport interface ProgressSpinnerProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'size'> {\n ariaLabel?: string;\n size?: 'small' | 'medium' | 'big' | 'large';\n stroke?: '1' | '2' | '3' | '4';\n}\n\nexport const ProgressSpinner: FunctionComponent<ProgressSpinnerProps> = ({\n ariaLabel,\n size = 'small',\n stroke = '4',\n children,\n className,\n style,\n ...props\n}) => {\n const commonClasses = [\n 'dropin-progress-spinner',\n `dropin-progress-spinner--shape-size-${size}`,\n `dropin-progress-spinner--shape-stroke-${stroke}`,\n ];\n\n const translations = useText({\n updating: 'Dropin.ProgressSpinner.updating.label',\n updatingChildren: 'Dropin.ProgressSpinner.updatingChildren.label',\n });\n\n const handleAriaLabel = () => {\n if (ariaLabel) return ariaLabel;\n return children ? translations.updatingChildren : translations.updating;\n };\n\n return children ? (\n // if we provide children to this component, it should act as a provider in order to add background with low opacity\n <div\n {...props}\n className={classes(['dropin-progress-spinner-provider'])}\n aria-live=\"polite\"\n role=\"status\"\n >\n <div aria-hidden={true}>{children}</div>\n <div\n aria-label={handleAriaLabel()}\n role=\"status\"\n className={classes(['dropin-progress-spinner-background', className])}\n style={style}\n />\n <div\n className={classes([\n 'dropin-progress-spinner-with-provider',\n ...commonClasses,\n ])}\n aria-hidden={true}\n />\n </div>\n ) : (\n // if there are no children, it should be able to be standalone and have no background\n <div\n {...props}\n className={classes([className, ...commonClasses])}\n aria-live=\"polite\"\n role=\"status\"\n aria-label={handleAriaLabel()}\n />\n );\n};\n"],"names":["ProgressSpinner","ariaLabel","size","stroke","children","className","style","props","commonClasses","translations","useText","updating","updatingChildren","handleAriaLabel","_jsxs","classes","role","_jsx"],"mappings":"8OAkBO,MAAMA,EAA2DA,CAAC,CACvEC,UAAAA,EACAC,KAAAA,EAAO,QACPC,OAAAA,EAAS,IACTC,SAAAA,EACAC,UAAAA,EACAC,MAAAA,EACA,GAAGC,CACL,IAAM,CACEC,MAAAA,EAAgB,CACpB,0BACC,uCAAsCN,CAAK,GAC3C,yCAAwCC,CAAO,EAAC,EAG7CM,EAAeC,EAAQ,CAC3BC,SAAU,wCACVC,iBAAkB,+CAAA,CACnB,EAEKC,EAAkBA,IAClBZ,IACGG,EAAWK,EAAaG,iBAAmBH,EAAaE,UAG1DP,OAAAA,EAELU,EAAA,MAAA,CAAA,GACMP,EACJF,UAAWU,EAAQ,CAAC,kCAAkC,CAAC,EACvD,YAAU,SACVC,KAAK,SAAQZ,UAEba,EAAA,MAAA,CAAK,cAAa,GAAKb,SAAAA,CAAAA,CAAgB,EACvCa,EAAA,MAAA,CACE,aAAYJ,EAAgB,EAC5BG,KAAK,SACLX,UAAWU,EAAQ,CAAC,qCAAsCV,CAAS,CAAC,EACpEC,MAAAA,CAAAA,CACD,EACDW,EAAA,MAAA,CACEZ,UAAWU,EAAQ,CACjB,wCACA,GAAGP,CAAa,CACjB,EACD,cAAa,EAAA,CACd,CAAC,CAAA,CACC,EAGLS,EAAA,MAAA,CAAA,GACMV,EACJF,UAAWU,EAAQ,CAACV,EAAW,GAAGG,CAAa,CAAC,EAChD,YAAU,SACVQ,KAAK,SACL,aAAYH,EAAgB,CAAA,CAC7B,CAEL"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{c as i}from"../chunks/classes__DJBjVfEyCI.js";import"../chunks/image-params-keymap__LH6wjfp1fd.js";import"../preact.js";import{jsx as r}from"../preact-jsx-runtime.js";const h=({name:a,label:d,value:p,size:n="medium",checked:e=!1,disabled:o=!1,error:t=!1,description:l="",className:s,children:_,...u})=>r("label",{className:i([s,"dropin-radio-button",["dropin-radio-button--error",t],["dropin-radio-button--disabled",o]]),children:[r("input",{name:a,value:p,checked:e,disabled:o,type:"radio",className:i(["dropin-radio-button__input",["dropin-radio-button__input--error",t],["dropin-radio-button__input--disabled",o]]),...u}),r("span",{className:i(["dropin-radio-button__label",`dropin-radio-button__label--${n}`,["dropin-radio-button__label--error",t],["dropin-radio-button__label--disabled",o]]),children:d}),r("span",{className:i(["dropin-radio-button__description",`dropin-radio-button__description--${n}`,["dropin-radio-button__description--disabled",o]]),children:l})]});export{h as RadioButton,h as default};
|
|
2
|
+
//# sourceMappingURL=RadioButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RadioButton.js","sources":["../../src/components/RadioButton/RadioButton.tsx"],"sourcesContent":["import { FunctionComponent, VNode } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { classes } from '@adobe/elsie/lib';\nimport '@adobe/elsie/components/RadioButton/RadioButton.css';\n\nexport interface RadioButtonProps\n extends Omit<HTMLAttributes<HTMLInputElement>, 'size' | 'label'> {\n label: string | VNode<HTMLAttributes<HTMLElement>>;\n name: string;\n value: string;\n size?: 'medium' | 'large';\n checked?: boolean;\n disabled?: boolean;\n error?: boolean;\n description?: string;\n}\n\nexport const RadioButton: FunctionComponent<RadioButtonProps> = ({\n name,\n label,\n value,\n size = 'medium',\n checked = false,\n disabled = false,\n error = false,\n description = '',\n className,\n children,\n ...props\n}) => {\n return (\n <label\n className={classes([\n className,\n 'dropin-radio-button',\n ['dropin-radio-button--error', error],\n ['dropin-radio-button--disabled', disabled],\n ])}\n >\n <input\n name={name}\n value={value}\n checked={checked}\n disabled={disabled}\n type=\"radio\"\n className={classes([\n 'dropin-radio-button__input',\n ['dropin-radio-button__input--error', error],\n ['dropin-radio-button__input--disabled', disabled],\n ])}\n {...props}\n />\n <span\n className={classes([\n 'dropin-radio-button__label',\n `dropin-radio-button__label--${size}`,\n ['dropin-radio-button__label--error', error],\n ['dropin-radio-button__label--disabled', disabled],\n ])}\n >\n {label}\n </span>\n <span\n className={classes([\n 'dropin-radio-button__description',\n `dropin-radio-button__description--${size}`,\n ['dropin-radio-button__description--disabled', disabled],\n ])}\n >\n {description}\n </span>\n </label>\n );\n};\n"],"names":["RadioButton","name","label","value","size","checked","disabled","error","description","className","children","props","_jsxs","classes","_jsx","type"],"mappings":"8KAiBO,MAAMA,EAAmDA,CAAC,CAC/DC,KAAAA,EACAC,MAAAA,EACAC,MAAAA,EACAC,KAAAA,EAAO,SACPC,QAAAA,EAAU,GACVC,SAAAA,EAAW,GACXC,MAAAA,EAAQ,GACRC,YAAAA,EAAc,GACdC,UAAAA,EACAC,SAAAA,EACA,GAAGC,CACL,IAEIC,EAAA,QAAA,CACEH,UAAWI,EAAQ,CACjBJ,EACA,sBACA,CAAC,6BAA8BF,CAAK,EACpC,CAAC,gCAAiCD,CAAQ,CAAC,CAC5C,EAAEI,UAEHI,EAAA,QAAA,CACEb,KAAAA,EACAE,MAAAA,EACAE,QAAAA,EACAC,SAAAA,EACAS,KAAK,QACLN,UAAWI,EAAQ,CACjB,6BACA,CAAC,oCAAqCN,CAAK,EAC3C,CAAC,uCAAwCD,CAAQ,CAAC,CACnD,EAAE,GACCK,CAAAA,CACL,EACDG,EAAA,OAAA,CACEL,UAAWI,EAAQ,CACjB,6BACC,+BAA8BT,CAAK,GACpC,CAAC,oCAAqCG,CAAK,EAC3C,CAAC,uCAAwCD,CAAQ,CAAC,CACnD,EAAEI,SAEFR,CAAAA,CACG,EACNY,EAAA,OAAA,CACEL,UAAWI,EAAQ,CACjB,mCACC,qCAAoCT,CAAK,GAC1C,CAAC,6CAA8CE,CAAQ,CAAC,CACzD,EAAEI,SAEFF,CAAAA,CACG,CAAC,CAAA,CACF"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{c as n}from"../chunks/classes__DJBjVfEyCI.js";import"../chunks/image-params-keymap__LH6wjfp1fd.js";import"../preact.js";import{jsx as r}from"../preact-jsx-runtime.js";const m=1,y=({className:o,fullWidth:e=!1,lines:l=m,size:t="small",variant:s="row",children:i=null,multilineGap:k="medium",...p})=>{const d=[[`dropin-skeleton-row__${s}`,s],[`dropin-skeleton-row__${s}-${t}`,s&&t]];if(!i&&s==="empty")return r("div",{className:n(["dropin-skeleton-row dropin-skeleton-row__empty",o])});if(i){const a=i.trim();return r("div",{...p,class:n(["dropin-skeleton-row",["dropin-skeleton-row--full",e],o]),dangerouslySetInnerHTML:{__html:a}})}return l>m===!1?r("div",{...p,class:n(["dropin-skeleton-row",["dropin-skeleton-row--full",e],"dropin-skeleton--row__content",...d,o])}):r("div",{...p,style:{"--multiline-gap-spacing":`var(--spacing-${k})`},class:n(["dropin-skeleton-row--multiline",["dropin-skeleton-row--full",e],o]),children:Array.from({length:l}).map((a,w)=>r("div",{class:n(["dropin-skeleton-row",["dropin-skeleton-row--full",e],"dropin-skeleton--row__content",...d])},w))})},v=({className:o,children:e,rowGap:l="medium",...t})=>r("div",{style:{"--row-gap-spacing":`var(--spacing-${l})`},...t,className:n(["dropin-skeleton",o]),role:"status","aria-label":"Loading...",children:e});export{v as Skeleton,y as SkeletonRow};
|
|
2
|
+
//# sourceMappingURL=Skeleton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Skeleton.js","sources":["../../src/components/Skeleton/Skeleton.tsx"],"sourcesContent":["import { FunctionComponent } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { classes } from '@adobe/elsie/lib';\nimport '@adobe/elsie/components/Skeleton/Skeleton.css';\n\nexport interface SkeletonRowProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'size'> {\n fullWidth?: boolean;\n lines?: number;\n size?: 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge';\n variant?: 'heading' | 'row' | 'empty';\n multilineGap?: 'xsmall' | 'small' | 'medium' | 'big' | 'xbig';\n children?: string;\n}\n\nconst SINGLELINE = 1;\n\nexport const SkeletonRow: FunctionComponent<SkeletonRowProps> = ({\n className,\n fullWidth = false,\n lines = SINGLELINE,\n size = 'small',\n variant = 'row',\n children = null,\n multilineGap = 'medium',\n ...props\n}) => {\n const sharedClasses = [\n [`dropin-skeleton-row__${variant}`, variant],\n [`dropin-skeleton-row__${variant}-${size}`, variant && size],\n ];\n\n if (!children && variant === 'empty') {\n return (\n <div\n className={classes([\n 'dropin-skeleton-row dropin-skeleton-row__empty',\n className,\n ])}\n />\n );\n }\n\n if (children) {\n const svg = children.trim();\n return (\n <div\n {...props}\n class={classes([\n 'dropin-skeleton-row',\n [`dropin-skeleton-row--full`, fullWidth],\n className,\n ])}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{ __html: svg }}\n />\n );\n }\n\n const isMultiline = lines > SINGLELINE;\n\n if (isMultiline === false) {\n return (\n <div\n {...props}\n class={classes([\n 'dropin-skeleton-row',\n [`dropin-skeleton-row--full`, fullWidth],\n 'dropin-skeleton--row__content',\n ...sharedClasses,\n className,\n ])}\n />\n );\n }\n\n return (\n <div\n {...props}\n style={{ '--multiline-gap-spacing': `var(--spacing-${multilineGap})` }}\n class={classes([\n 'dropin-skeleton-row--multiline',\n [`dropin-skeleton-row--full`, fullWidth],\n className,\n ])}\n >\n {Array.from({ length: lines }).map((_, index) => (\n <div\n key={index}\n class={classes([\n 'dropin-skeleton-row',\n [`dropin-skeleton-row--full`, fullWidth],\n 'dropin-skeleton--row__content',\n ...sharedClasses,\n ])}\n />\n ))}\n </div>\n );\n};\n\nexport interface SkeletonProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'size'> {\n rowGap?: 'xsmall' | 'small' | 'medium' | 'big' | 'xbig';\n}\n\nexport const Skeleton: FunctionComponent<SkeletonProps> = ({\n className,\n children,\n rowGap = 'medium',\n ...props\n}) => {\n return (\n <div\n style={{ '--row-gap-spacing': `var(--spacing-${rowGap})` }}\n {...props}\n className={classes(['dropin-skeleton', className])}\n role=\"status\"\n aria-label=\"Loading...\"\n >\n {children}\n </div>\n );\n};\n"],"names":["SINGLELINE","SkeletonRow","className","fullWidth","lines","size","variant","children","multilineGap","props","sharedClasses","_jsx","classes","svg","trim","class","dangerouslySetInnerHTML","__html","style","Array","from","length","map","_","index","Skeleton","rowGap","role"],"mappings":"8KAeA,MAAMA,EAAa,EAENC,EAAmDA,CAAC,CAC/DC,UAAAA,EACAC,UAAAA,EAAY,GACZC,MAAAA,EAAQJ,EACRK,KAAAA,EAAO,QACPC,QAAAA,EAAU,MACVC,SAAAA,EAAW,KACXC,aAAAA,EAAe,SACf,GAAGC,CACL,IAAM,CACJ,MAAMC,EAAgB,CACpB,CAAE,wBAAuBJ,CAAQ,GAAGA,CAAO,EAC3C,CAAE,wBAAuBA,CAAQ,IAAGD,CAAK,GAAGC,GAAWD,CAAI,CAAC,EAG1D,GAAA,CAACE,GAAYD,IAAY,QAC3B,OACEK,EAAA,MAAA,CACET,UAAWU,EAAQ,CACjB,iDACAV,CAAS,CACV,CAAA,CACF,EAIL,GAAIK,EAAU,CACNM,MAAAA,EAAMN,EAASO,OACrB,OACEH,EAAA,MAAA,CAAA,GACMF,EACJM,MAAOH,EAAQ,CACb,sBACA,CAAE,4BAA4BT,CAAS,EACvCD,CAAS,CACV,EAEDc,wBAAyB,CAAEC,OAAQJ,CAAI,CAAA,CACxC,CAEL,CAIA,OAFoBT,EAAQJ,IAER,GAEhBW,EAAA,MAAA,CAAA,GACMF,EACJM,MAAOH,EAAQ,CACb,sBACA,CAAE,4BAA4BT,CAAS,EACvC,gCACA,GAAGO,EACHR,CAAS,CACV,CAAA,CACF,EAKHS,EAAA,MAAA,CAAA,GACMF,EACJS,MAAO,CAAE,0BAA4B,iBAAgBV,CAAa,GAAG,EACrEO,MAAOH,EAAQ,CACb,iCACA,CAAE,4BAA4BT,CAAS,EACvCD,CAAS,CACV,EAAEK,SAEFY,MAAMC,KAAK,CAAEC,OAAQjB,CAAAA,CAAO,EAAEkB,IAAI,CAACC,EAAGC,IACrCb,EAAA,MAAA,CAEEI,MAAOH,EAAQ,CACb,sBACA,CAAE,4BAA4BT,CAAS,EACvC,gCACA,GAAGO,CAAa,CACjB,CAAE,EANEc,CAON,CACF,CAAA,CACE,CAET,EAOaC,EAA6CA,CAAC,CACzDvB,UAAAA,EACAK,SAAAA,EACAmB,OAAAA,EAAS,SACT,GAAGjB,CACL,IAEIE,EAAA,MAAA,CACEO,MAAO,CAAE,oBAAsB,iBAAgBQ,CAAO,GAAG,EAAE,GACvDjB,EACJP,UAAWU,EAAQ,CAAC,kBAAmBV,CAAS,CAAC,EACjDyB,KAAK,SACL,aAAW,aAAYpB,SAAAA,CAAAA,CAGpB"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"../preact-compat.js";import{c as d}from"../chunks/classes__DJBjVfEyCI.js";import"../chunks/image-params-keymap__LH6wjfp1fd.js";import"../preact.js";import{jsx as o}from"../preact-jsx-runtime.js";import{useText as i}from"../i18n.js";import{useState as g,useRef as C,useCallback as F,useEffect as L}from"../preact-hooks.js";const q=({className:f,name:w,value:m,label:t,groupAriaLabel:a,id:h,disabled:p=!1,selected:s=!1,outOfStock:u=!1,multi:x=!1,onValue:c,onUpdateError:n,...b})=>{const $=i("Dropin.Swatches.outOfStock.label").label,_=i("Dropin.Swatches.selected.label").label,S=i("Dropin.Swatches.swatch.label").label,[k,v]=g(!1),e=C(null),O=F(async r=>{if(c)try{await c(r)}catch(l){n&&n(l)}},[c,n]),y=r=>{const l=r.target;O(l.value)},D=()=>u?`${a}: ${t} ${$}`:s?`${a}: ${t} ${_}`:`${a}: ${t} ${S}`;return L(()=>{e.current&&e.current.scrollWidth>e.current.clientWidth&&v(!0)},[t]),o("div",{className:"dropin-text-swatch__container",...k?{"data-tooltip":t}:{},children:[o("input",{type:x?"checkbox":"radio",name:w,id:h,value:m,"aria-label":D(),checked:s,disabled:p,onChange:y,...b,className:d(["dropin-text-swatch",["dropin-text-swatch--selected",s],["dropin-text-swatch--disabled",p],f])}),o("label",{htmlFor:h,ref:e,className:d(["dropin-text-swatch__label",["dropin-text-swatch__label--out-of-stock",u],f]),children:t})]})};export{q as TextSwatch,q as default};
|
|
2
|
+
//# sourceMappingURL=TextSwatch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextSwatch.js","sources":["../../src/components/TextSwatch/TextSwatch.tsx"],"sourcesContent":["import { FunctionComponent } from 'preact';\nimport {\n HTMLAttributes,\n useState,\n useEffect,\n useRef,\n useCallback,\n} from 'preact/compat';\nimport { classes } from '@adobe/elsie/lib';\nimport '@adobe/elsie/components/TextSwatch/TextSwatch.css';\nimport { useText } from '@adobe/elsie/i18n';\n\nexport interface TextSwatchProps\n extends Omit<HTMLAttributes<HTMLInputElement>, 'label'> {\n name?: string;\n label: string;\n groupAriaLabel?: string;\n value?: string;\n id: string;\n disabled?: boolean;\n selected?: boolean;\n outOfStock?: boolean;\n multi?: boolean;\n onValue?: (value: any) => void;\n onUpdateError?: (error: Error) => void;\n}\n\nexport const TextSwatch: FunctionComponent<TextSwatchProps> = ({\n className,\n name,\n value,\n label,\n groupAriaLabel,\n id,\n disabled = false,\n selected = false,\n outOfStock = false,\n multi = false,\n onValue,\n onUpdateError,\n ...props\n}) => {\n // i18n\n const outOfStockLabel = useText('Dropin.Swatches.outOfStock.label').label;\n const selectedLabel = useText('Dropin.Swatches.selected.label').label;\n const swatchLabel = useText('Dropin.Swatches.swatch.label').label;\n\n const [isOverflowing, setIsOverflowing] = useState(false);\n const spanRef = useRef<HTMLLabelElement>(null);\n\n const onValueHandler = useCallback(\n async (newValue: any) => {\n if (onValue) {\n try {\n await onValue(newValue);\n } catch (e) {\n if (onUpdateError) {\n onUpdateError(e as Error);\n }\n }\n }\n },\n [onValue, onUpdateError]\n );\n\n const handleOnValue = (e: Event) => {\n const input = e.target as HTMLInputElement;\n\n onValueHandler(input.value);\n };\n\n const handleAriaLabel = () => {\n if (outOfStock) return `${groupAriaLabel}: ${label} ${outOfStockLabel}`;\n if (selected) return `${groupAriaLabel}: ${label} ${selectedLabel}`;\n return `${groupAriaLabel}: ${label} ${swatchLabel}`;\n };\n\n useEffect(() => {\n if (\n spanRef.current &&\n spanRef.current.scrollWidth > spanRef.current.clientWidth\n ) {\n setIsOverflowing(true);\n }\n }, [label]);\n\n return (\n <div\n className=\"dropin-text-swatch__container\"\n {...(isOverflowing ? { 'data-tooltip': label } : {})}\n >\n <input\n type={multi ? 'checkbox' : 'radio'}\n name={name}\n id={id}\n value={value}\n aria-label={handleAriaLabel()}\n checked={selected}\n disabled={disabled}\n onChange={handleOnValue}\n {...props}\n className={classes([\n 'dropin-text-swatch',\n ['dropin-text-swatch--selected', selected],\n ['dropin-text-swatch--disabled', disabled],\n className,\n ])}\n />\n <label\n htmlFor={id}\n ref={spanRef}\n className={classes([\n 'dropin-text-swatch__label',\n ['dropin-text-swatch__label--out-of-stock', outOfStock],\n className,\n ])}\n >\n {label}\n </label>\n </div>\n );\n};\n"],"names":["TextSwatch","className","name","value","label","groupAriaLabel","id","disabled","selected","outOfStock","multi","onValue","onUpdateError","props","outOfStockLabel","useText","selectedLabel","swatchLabel","isOverflowing","setIsOverflowing","useState","spanRef","useRef","onValueHandler","useCallback","newValue","e","handleOnValue","input","target","handleAriaLabel","useEffect","current","scrollWidth","clientWidth","_jsxs","children","_jsx","type","checked","onChange","classes","htmlFor","ref"],"mappings":"yUA2BO,MAAMA,EAAiDA,CAAC,CAC7DC,UAAAA,EACAC,KAAAA,EACAC,MAAAA,EACAC,MAAAA,EACAC,eAAAA,EACAC,GAAAA,EACAC,SAAAA,EAAW,GACXC,SAAAA,EAAW,GACXC,WAAAA,EAAa,GACbC,MAAAA,EAAQ,GACRC,QAAAA,EACAC,cAAAA,EACA,GAAGC,CACL,IAAM,CAEEC,MAAAA,EAAkBC,EAAQ,kCAAkC,EAAEX,MAC9DY,EAAgBD,EAAQ,gCAAgC,EAAEX,MAC1Da,EAAcF,EAAQ,8BAA8B,E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1,2 +1,2 @@
|
|
|
1
|
-
import"../preact-compat.js";import{c as u}from"../chunks/classes__DJBjVfEyCI.js";import{d as i
|
|
1
|
+
import"../preact-compat.js";import{c as u}from"../chunks/classes__DJBjVfEyCI.js";import{d as i}from"../chunks/image-params-keymap__LH6wjfp1fd.js";import{createContext as p}from"../preact.js";import{jsx as a}from"../preact-jsx-runtime.js";import{IntlProvider as b}from"../i18n.js";import{useMemo as x}from"../preact-hooks.js";const h={ExampleComponentName:{item:{label:"string"}},Incrementer:{decreaseLabel:"Decrease Quantity",increaseLabel:"Increase Quantity",label:"Quantity"},Modal:{Close:{label:"Close"}},InlineAlert:{dismissLabel:"Dismiss Alert"},PriceSummary:{subTotal:{label:"Subtotal",withTaxes:"Including taxes",withoutTaxes:"excluding taxes"},shipping:{label:"Shipping",editZipAction:"Apply",estimated:"Estimated Shipping",estimatedDestination:"Estimated Shipping to ",destinationLinkAriaLabel:"Change destination",zipPlaceholder:"Zip Code",withTaxes:"Including taxes",withoutTaxes:"excluding taxes",alternateField:{zip:"Estimate using country/zip",state:"Estimate using country/state"}},taxes:{total:"Tax Total",totalOnly:"Tax",breakdown:"Taxes",showBreakdown:"Show Tax Breakdown",hideBreakdown:"Hide Tax Breakdown",estimated:"Estimated Tax"},total:{estimated:"Estimated Total",label:"Total",withoutTax:"Total excluding taxes"}},ProgressSpinner:{updating:{label:"Item is updating"},updatingChildren:{label:"Items are updating"}},PriceRange:{from:{label:"From"},to:{label:"to"},asLowAs:{label:"As low as"}},Swatches:{outOfStock:{label:"out of stock swatch"},selected:{label:"swatch selected"},swatch:{label:"swatch"}},Accordion:{open:{label:"Open"},close:{label:"Close"}},CartItem:{each:{label:"each"},quantity:{label:"Quantity"},remove:{label:"Remove {product} from the cart"},removeDefault:{label:"Remove item from the cart"},taxIncluded:{label:"incl. VAT"},taxExcluded:{label:"excl. tax"},updating:{label:"{product} is updating"}}},l={Dropin:h},o={default:l,en_US:l},g=e=>i(o.default,o[e]||{}),w=p({locale:"en-US"}),A=({lang:e="en_US",langDefinitions:t={},className:n,children:s,...r})=>{const d=x(()=>{const m=i(t.default,t[e]??{});return i(g(e),m)},[e,t]),c=e.replace("_","-");return a(w.Provider,{value:{locale:c},children:a(b,{definition:d,children:a("div",{...r,className:u(["dropin-design",n]),children:s})})})};export{w as UIContext,A as UIProvider};
|
|
2
2
|
//# sourceMappingURL=UIProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UIProvider.js","sources":["../../src/i18n/index.ts","../../src/components/UIProvider/UIProvider.tsx"],"sourcesContent":["import { deepmerge } from '@adobe/elsie/lib';\nimport en_US from '@adobe/elsie/i18n/en_US.json';\n\nexport type Lang = 'en_US';\n\nexport const definition = {\n default: en_US,\n en_US,\n};\n\n// https://github.com/synacor/preact-i18n\n// eslint-disable-next-line no-restricted-imports\nexport * from 'preact-i18n';\n\nexport const getDefinitionByLanguage = (lang: Lang) => {\n return deepmerge(definition.default, definition[lang] || {});\n};\n","import { FunctionComponent } from 'preact';\nimport { HTMLAttributes, createContext, useMemo } from 'preact/compat';\nimport { classes, deepmerge } from '@adobe/elsie/lib';\nimport { IntlProvider, getDefinitionByLanguage, Lang } from '@adobe/elsie/i18n';\n\nimport '@adobe/elsie/components/UIProvider/UIProvider.css';\nimport '@adobe/elsie/components/UIProvider/normalize.css';\n\nexport const UIContext = createContext<{\n locale: string;\n}>({\n locale: 'en-US',\n});\n\ntype LangDefinitions = { [key: string]: any };\n\nexport interface UIProviderProps extends HTMLAttributes<HTMLDivElement> {\n lang?: Lang; // ... list of other supported languages\n langDefinitions?: LangDefinitions;\n}\n\nexport const UIProvider: FunctionComponent<UIProviderProps> = ({\n lang = 'en_US',\n langDefinitions = {},\n className,\n children,\n ...props\n}) => {\n const definitions = useMemo(() => {\n // Merge default definition with selected definition\n const selectedDefinitions: LangDefinitions = deepmerge(\n langDefinitions.default,\n langDefinitions[lang] ?? {}\n );\n\n // Merge SDK default definitions with custom definitions\n return deepmerge(\n getDefinitionByLanguage(lang), // SDK default definitions\n selectedDefinitions // Custom definitions\n );\n }, [lang, langDefinitions]);\n\n const locale = lang.replace('_', '-')\n \n return (\n <UIContext.Provider value={{ locale }}>\n <IntlProvider definition={definitions}>\n <div {...props} className={classes(['dropin-design', className])}>\n {children}\n </div>\n </IntlProvider>\n </UIContext.Provider>\n );\n};\n"],"names":["definition","default","en_US","getDefinitionByLanguage","lang","deepmerge","UIContext","createContext","locale","UIProvider","langDefinitions","className","children","props","definitions","useMemo","selectedDefinitions","replace","_jsx","Provider","value","IntlProvider","classes"],"mappings":"
|
|
1
|
+
{"version":3,"file":"UIProvider.js","sources":["../../src/i18n/index.ts","../../src/components/UIProvider/UIProvider.tsx"],"sourcesContent":["import { deepmerge } from '@adobe/elsie/lib';\nimport en_US from '@adobe/elsie/i18n/en_US.json';\n\nexport type Lang = 'en_US';\n\nexport const definition = {\n default: en_US,\n en_US,\n};\n\n// https://github.com/synacor/preact-i18n\n// eslint-disable-next-line no-restricted-imports\nexport * from 'preact-i18n';\n\nexport const getDefinitionByLanguage = (lang: Lang) => {\n return deepmerge(definition.default, definition[lang] || {});\n};\n","import { FunctionComponent } from 'preact';\nimport { HTMLAttributes, createContext, useMemo } from 'preact/compat';\nimport { classes, deepmerge } from '@adobe/elsie/lib';\nimport { IntlProvider, getDefinitionByLanguage, Lang } from '@adobe/elsie/i18n';\n\nimport '@adobe/elsie/components/UIProvider/UIProvider.css';\nimport '@adobe/elsie/components/UIProvider/normalize.css';\n\nexport const UIContext = createContext<{\n locale: string;\n}>({\n locale: 'en-US',\n});\n\ntype LangDefinitions = { [key: string]: any };\n\nexport interface UIProviderProps extends HTMLAttributes<HTMLDivElement> {\n lang?: Lang; // ... list of other supported languages\n langDefinitions?: LangDefinitions;\n}\n\nexport const UIProvider: FunctionComponent<UIProviderProps> = ({\n lang = 'en_US',\n langDefinitions = {},\n className,\n children,\n ...props\n}) => {\n const definitions = useMemo(() => {\n // Merge default definition with selected definition\n const selectedDefinitions: LangDefinitions = deepmerge(\n langDefinitions.default,\n langDefinitions[lang] ?? {}\n );\n\n // Merge SDK default definitions with custom definitions\n return deepmerge(\n getDefinitionByLanguage(lang), // SDK default definitions\n selectedDefinitions // Custom definitions\n );\n }, [lang, langDefinitions]);\n\n const locale = lang.replace('_', '-')\n \n return (\n <UIContext.Provider value={{ locale }}>\n <IntlProvider definition={definitions}>\n <div {...props} className={classes(['dropin-design', className])}>\n {children}\n </div>\n </IntlProvider>\n </UIContext.Provider>\n );\n};\n"],"names":["definition","default","en_US","getDefinitionByLanguage","lang","deepmerge","UIContext","createContext","locale","UIProvider","langDefinitions","className","children","props","definitions","useMemo","selectedDefinitions","replace","_jsx","Provider","value","IntlProvider","classes"],"mappings":"i0DAKaA,EAAa,CACxBC,QAASC,EACTA,MAAAA,CACF,EAMaC,EAA2BC,GAC/BC,EAAUL,EAAWC,QAASD,EAAWI,CAAI,GAAK,CAAA,CAAE,ECPhDE,EAAYC,EAEtB,CACDC,OAAQ,OACV,CAAC,EASYC,EAAiDA,CAAC,CAC7DL,KAAAA,EAAO,QACPM,gBAAAA,EAAkB,CAAC,EACnBC,UAAAA,EACAC,SAAAA,EACA,GAAGC,CACL,IAAM,CACEC,MAAAA,EAAcC,EAAQ,IAAM,CAE1BC,MAAAA,EAAuCX,EAC3CK,EAAgBT,QAChBS,EAAgBN,CAAI,GAAK,CAAA,CAC3B,EAGOC,OAAAA,EACLF,EAAwBC,CAAI,EAC5BY,CAAAA,CACF,EACC,CAACZ,EAAMM,CAAe,CAAC,EAEpBF,EAASJ,EAAKa,QAAQ,IAAK,GAAG,EAGlCC,OAAAA,EAACZ,EAAUa,SAAQ,CAACC,MAAO,CAAEZ,OAAAA,CAAO,EAAEI,SACpCM,EAACG,EAAY,CAACrB,WAAYc,EAAYF,SACpCM,EAAA,MAAA,CAAA,GAASL,EAAOF,UAAWW,EAAQ,CAAC,gBAAiBX,CAAS,CAAC,EAAEC,SAAAA,CAAAA,CAE5D,CAAA,CACO,CAAA,CACI,CAExB"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Skeleton as B,SkeletonRow as P}from"./Skeleton.js";import{UIContext as k,UIProvider as h}from"./UIProvider.js";import{Incrementer as R}from"./Incrementer.js";import{default as v}from"./Input.js";import{Image as M}from"./Image.js";import{default as y}from"./Divider.js";import{Icon as F}from"./Icon.js";import{Price as T}from"./Price.js";import{default as q}from"./RadioButton.js";import{default as E}from"./Button.js";import{Picker as J}from"./Picker.js";import{Field as N}from"./Field.js";import{ActionButton as Q}from"./ActionButton.js";import{ActionButtonGroup as W}from"./ActionButtonGroup.js";import{Card as Y}from"./Card.js";import{Checkbox as _}from"./Checkbox.js";import{default as rr}from"./ColorSwatch.js";import{default as tr}from"./TextSwatch.js";import{default as mr}from"./ProgressSpinner.js";import{default as pr}from"./ImageSwatch.js";import{default as ir,AccordionSection as xr}from"./Accordion.js";import{default as lr}from"./InLineAlert.js";import{Modal as nr}from"./Modal.js";import{default as cr,CartItemSkeleton as Ir}from"./CartItem.js";import{default as Cr}from"./PriceSummary.js";import{default as Br}from"./CartList.js";import{default as gr}from"./PriceRange.js";import{default as hr}from"./Breadcrumbs.js";import{default as Rr}from"./AlertBanner.js";import{default as vr}from"./IllustratedMessage.js";import"../chunks/classes__DJBjVfEyCI.js";import"../chunks/image-params-keymap__LH6wjfp1fd.js";import"../preact.js";import"../preact-jsx-runtime.js";import"../preact-compat.js";import"../preact-hooks.js";import"../i18n.js";import"../chunks/debounce__BF4Cdv7Ils.js";import"../chunks/Add__CiEO_sX7HP.js";import"../chunks/Minus__CefO5Dkv_0.js";import"../chunks/CheckWithCircle__D4l-TfZdbK.js";import"../chunks/WarningWithCircle__z1B4rFgzNa.js";import"../chunks/vcomponent__BjnR-FRhjl.js";import"../chunks/ChevronDown__BQ2yC5Yu4N.js";import"../chunks/Check__DlOKHUTGj4.js";import"../chunks/Close__DQxKl-RcDt.js";import"../chunks/Trash__BVZwxilyNs.js";import"../chunks/ChevronUp__DKfBFRUuWH.js";export{ir as Accordion,xr as AccordionSection,Q as ActionButton,W as ActionButtonGroup,Rr as AlertBanner,hr as Breadcrumbs,E as Button,Y as Card,cr as CartItem,Ir as CartItemSkeleton,Br as CartList,_ as Checkbox,rr as ColorSwatch,y as Divider,N as Field,F as Icon,vr as IllustratedMessage,M as Image,pr as ImageSwatch,lr as InLineAlert,R as Incrementer,v as Input,nr as Modal,J as Picker,T as Price,gr as PriceRange,Cr as PriceSummary,mr as ProgressSpinner,q as RadioButton,B as Skeleton,P as SkeletonRow,tr as TextSwatch,k as UIContext,h as UIProvider};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/i18n.js
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{createElement as p,Component as er,createContext as or,cloneElement as G}from"./preact.js";import{useContext as C}from"./preact-hooks.js";function B(r,t,n,e,a){for(t=t.split?t.split("."):t,e=0;e<t.length;e++)r=r?r[t[e]]:a;return r===a?n:r}var R,ar={};function u(r,t,n){if(r.nodeType===3){var e="textContent"in r?r.textContent:r.nodeValue||"";if(u.options.trim!==!1){var a=t===0||t===n.length-1;if((!(e=e.match(/^[\s\n]+$/g)&&u.options.trim!=="all"?" ":e.replace(/(^[\s\n]+|[\s\n]+$)/g,u.options.trim==="all"||a?"":" "))||e===" ")&&n.length>1&&a)return null}return e}if(r.nodeType!==1)return null;var i=String(r.nodeName).toLowerCase();if(i==="script"&&!u.options.allowScripts)return null;var o,l,c=u.h(i,function(m){var j=m&&m.length;if(!j)return null;for(var M={},k=0;k<j;k++){var d=m[k],O=d.name,T=d.value;O.substring(0,2)==="on"&&u.options.allowEvents&&(T=new Function(T)),M[O]=T}return M}(r.attributes),(l=(o=r.childNodes)&&Array.prototype.map.call(o,u).filter(ir))&&l.length?l:null);return u.visitor&&u.visitor(c),c}var V,ir=function(r){return r},lr={};function N(r){var t=(r.type||"").toLowerCase(),n=N.map;n&&n.hasOwnProperty(t)?(r.type=n[t],r.props=Object.keys(r.props||{}).reduce(function(e,a){var i;return e[i=a,i.replace(/-(.)/g,function(o,l){return l.toUpperCase()})]=r.props[a],e},{})):r.type=t.replace(/[^a-z0-9-]/i,"")}const ur=function(r){function t(){r.apply(this,arguments)}return r&&(t.__proto__=r),(t.prototype=Object.create(r&&r.prototype)).constructor=t,t.setReviver=function(n){V=n},t.prototype.shouldComponentUpdate=function(n){var e=this.props;return n.wrap!==e.wrap||n.type!==e.type||n.markup!==e.markup},t.prototype.setComponents=function(n){if(this.map={},n){for(var e in n)if(n.hasOwnProperty(e)){var a=e.replace(/([A-Z]+)([A-Z][a-z0-9])|([a-z0-9]+)([A-Z])/g,"$1$3-$2$4").toLowerCase();this.map[a]=n[e]}}},t.prototype.render=function(n){var e=n.wrap;e===void 0&&(e=!0);var a,i=n.type,o=n.markup,l=n.components,c=n.reviver,m=n.onError,j=n["allow-scripts"],M=n["allow-events"],k=n.trim,d=function(h,_){var z={};for(var w in h)Object.prototype.hasOwnProperty.call(h,w)&&_.indexOf(w)===-1&&(z[w]=h[w]);return z}(n,["wrap","type","markup","components","reviver","onError","allow-scripts","allow-events","trim"]),O=c||this.reviver||this.constructor.prototype.reviver||V||p;this.setComponents(l);var T={allowScripts:j,allowEvents:M,trim:k};try{a=function(h,_,z,w,tr){var x=function(P,$){var v,A,I,H,nr=$==="html"?"text/html":"application/xml";$==="html"?(H="body",I=`<!DOCTYPE html>
|
|
2
|
+
<html><body>`+P+"</body></html>"):(H="xml",I=`<?xml version="1.0" encoding="UTF-8"?>
|
|
3
|
+
<xml>`+P+"</xml>");try{v=new DOMParser().parseFromString(I,nr)}catch(b){A=b}if(v||$!=="html"||((v=R||(R=function(){if(document.implementation&&document.implementation.createHTMLDocument)return document.implementation.createHTMLDocument("");var b=document.createElement("iframe");return b.style.cssText="position:absolute; left:0; top:-999em; width:1px; height:1px; overflow:hidden;",b.setAttribute("sandbox","allow-forms"),document.body.appendChild(b),b.contentWindow.document}())).open(),v.write(I),v.close()),v){var E=v.getElementsByTagName(H)[0],f=E.firstChild;return P&&!f&&(E.error="Document parse failed."),f&&String(f.nodeName).toLowerCase()==="parsererror"&&(f.removeChild(f.firstChild),f.removeChild(f.lastChild),E.error=f.textContent||f.nodeValue||A||"Unknown error",E.removeChild(f)),E}}(h,_);if(x&&x.error)throw new Error(x.error);var Z=x&&x.body||x;N.map=w||lr;var F=Z&&function(P,$,v,A){return u.visitor=$,u.h=v,u.options=A||ar,u(P)}(Z,N,z,tr);return N.map=null,F&&F.props&&F.props.children||null}(o,i,O,this.map,T)}catch(h){m?m({error:h}):typeof console<"u"&&console.error&&console.error("preact-markup: "+h)}if(e===!1)return a||null;var U=d.hasOwnProperty("className")?"className":"class",g=d[U];return g?g.splice?g.splice(0,0,"markup"):typeof g=="string"?d[U]+=" markup":typeof g=="object"&&(g.markup=!0):d[U]="markup",O("div",d,a||null)},t}(er);var y=or({intl:{}});function Y(r){return r!=null}function W(r,t){for(var n in t)r[n]=t[n];return r}function q(r,t){var n=W({},r);for(var e in t)t.hasOwnProperty(e)&&(r[e]&&t[e]&&typeof r[e]=="object"&&typeof t[e]=="object"?n[e]=q(r[e],t[e]):n[e]=r[e]||t[e]);return n}function pr(r){if(r=r||{},typeof r=="string"&&(r=r.split(",")),"join"in r){for(var t={},n=0;n<r.length;n++){var e=r[n].trim();e&&(t[e.split(".").pop()]=e)}return t}return r}function cr(r,t){var n={};for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&t.indexOf(e)===-1&&(n[e]=r[e]);return n}var sr=/[?&#]intl=show/;function J(r){var t=r.scope,n=r.mark,e=r.definition,a=cr(r,["scope","mark","definition"]),i=a,o=C(y),l=o.intl,c=W({},l||{});return t&&(c.scope=t),e&&(c.dictionary=q(c.dictionary||{},e)),(n||typeof location<"u"&&String(location).match(sr))&&(c.mark=!0),p(y.Provider,{value:{intl:c}},i.children)}function s(r,t){if(arguments.length<2)return t=r,function(e){return s(e,t)};function n(e){return p(J,t||{},p(r,e))}return n.getWrappedComponent=r&&r.getWrappedComponent||function(){return r},n}var fr={};function K(r,t,n,e){return r&&r.replace(/\{\{([\w.-]+)\}\}/g,vr.bind(null,t||fr,n,e))}function vr(r,t,n,e,a){for(var i=a.split("."),o=r,l=0;l<i.length;l++){if(o=o[i[l]],o==null)return"";if(o&&o.type===D)return L(o.props.id,t,n,o.props.fields,o.props.plural,o.props.fallback)}return typeof o=="string"&&o.match(/\{\{/)&&(o=K(o,r)),o}function L(r,t,n,e,a,i){t&&(r=t+"."+r);var o=n&&B(n,r);return(a||a===0)&&o&&typeof o=="object"&&(o.splice?o=o[a]||o[0]:a===0&&Y(o.none||o.zero)?o=o.none||o.zero:a===1&&Y(o.one||o.singular)?o=o.one||o.singular:o=o.some||o.many||o.plural||o.other||o),o&&K(o,e,t,n)||i||null}function Q(r){var t=r.value,n=r.id,e=C(y),a=e.intl;if(a&&a.mark){var i="dictionary"+(a&&a.scope?"."+a.scope:"")+"."+n;return p("mark",{style:{background:t?B(a,i)?"rgba(119,231,117,.5)":"rgba(229,226,41,.5)":"rgba(228,147,51,.5)"},title:n},t)}return t}function D(r){var t=r.id,n=r.children,e=r.plural,a=r.fields,i=C(y),o=i.intl,l=L(t,o&&o.scope,o&&o.dictionary,a,e,n);return p(Q,{id:t,value:l})}function S(r,t,n){var e={};t=t||{},r=pr(r);for(var a in r)if(r.hasOwnProperty(a)&&r[a]){var i=r[a];!n&&typeof i=="string"?e[a]=L(i,t.scope,t.dictionary):i.type===D&&(i=W({fallback:i.props.children},i.props),e[a]=L(i.id,t.scope,t.dictionary,i.fields,i.plural,i.fallback))}return e}function X(r){var t=r.children,n=C(y),e=n.intl;return t&&t.length?t.map(function(a){return G(a,S(a.props,e,!0))}):t&&G(t,S(t.props,e,!0))}function rr(r,t){var n={};for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&t.indexOf(e)===-1&&(n[e]=r[e]);return n}function mr(r){var t=r.id,n=r.fields,e=r.plural,a=r.children,i=rr(r,["id","fields","plural","children"]),o=i;return p(X,null,p(dr,Object.assign({},{html:p(D,{id:t,fields:n,plural:e,children:a}),id:t},o)))}function dr(r){var t=r.html,n=r.id,e=rr(r,["html","id"]),a=e;return p(Q,{id:n,value:t&&(typeof t=="string"?p(ur,Object.assign({},{type:"html",trim:!1},a,{markup:t})):p("span",null,t))})}function hr(r){return function(n){function e(a,i){var o=C(y),l=o.intl,c=typeof r=="function"?r(a,{intl:l}):r,m=S(c,l);return p(n,W(W({},a),m))}return e.getWrappedComponent=n&&n.getWrappedComponent||function(){return n},e}}function yr(r){var t=C(y),n=t.intl;return S(typeof r=="function"?r({intl:n}):r,n)}s.intl=s;s.IntlContext=y;s.IntlProvider=J;s.Text=D;s.MarkupText=mr;s.Localizer=X;s.withText=hr;s.useText=yr;s.translate=L;export{y as IntlContext,J as IntlProvider,X as Localizer,mr as MarkupText,D as Text,s as default,s as intl,L as translate,yr as useText,hr as withText};
|
|
4
|
+
//# sourceMappingURL=i18n.js.map
|
package/i18n.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"i18n.js","sources":["../../../node_modules/dlv/dist/dlv.es.js","../../../node_modules/preact-markup/dist/preact-markup.module.js","../../../node_modules/preact-i18n/dist/preact-i18n.esm.js"],"sourcesContent":["export default function(t,e,l,n,r){for(e=e.split?e.split(\".\"):e,n=0;n<e.length;n++)t=t?t[e[n]]:r;return t===r?l:t}\n//# sourceMappingURL=dlv.es.js.map\n","import{h as r,Component as t}from\"preact\";var e,o={};function n(r,t,e){if(3===r.nodeType){var o=\"textContent\"in r?r.textContent:r.nodeValue||\"\";if(!1!==n.options.trim){var a=0===t||t===e.length-1;if((!(o=o.match(/^[\\s\\n]+$/g)&&\"all\"!==n.options.trim?\" \":o.replace(/(^[\\s\\n]+|[\\s\\n]+$)/g,\"all\"===n.options.trim||a?\"\":\" \"))||\" \"===o)&&e.length>1&&a)return null}return o}if(1!==r.nodeType)return null;var p=String(r.nodeName).toLowerCase();if(\"script\"===p&&!n.options.allowScripts)return null;var l,s,u=n.h(p,function(r){var t=r&&r.length;if(!t)return null;for(var e={},o=0;o<t;o++){var a=r[o],i=a.name,p=a.value;\"on\"===i.substring(0,2)&&n.options.allowEvents&&(p=new Function(p)),e[i]=p}return e}(r.attributes),(s=(l=r.childNodes)&&Array.prototype.map.call(l,n).filter(i))&&s.length?s:null);return n.visitor&&n.visitor(u),u}var a,i=function(r){return r},p={};function l(r){var t=(r.type||\"\").toLowerCase(),e=l.map;e&&e.hasOwnProperty(t)?(r.type=e[t],r.props=Object.keys(r.props||{}).reduce(function(t,e){var o;return t[(o=e,o.replace(/-(.)/g,function(r,t){return t.toUpperCase()}))]=r.props[e],t},{})):r.type=t.replace(/[^a-z0-9-]/i,\"\")}export default(function(t){function i(){t.apply(this,arguments)}return t&&(i.__proto__=t),(i.prototype=Object.create(t&&t.prototype)).constructor=i,i.setReviver=function(r){a=r},i.prototype.shouldComponentUpdate=function(r){var t=this.props;return r.wrap!==t.wrap||r.type!==t.type||r.markup!==t.markup},i.prototype.setComponents=function(r){if(this.map={},r)for(var t in r)if(r.hasOwnProperty(t)){var e=t.replace(/([A-Z]+)([A-Z][a-z0-9])|([a-z0-9]+)([A-Z])/g,\"$1$3-$2$4\").toLowerCase();this.map[e]=r[t]}},i.prototype.render=function(t){var i=t.wrap;void 0===i&&(i=!0);var s,u=t.type,c=t.markup,m=t.components,v=t.reviver,f=t.onError,d=t[\"allow-scripts\"],h=t[\"allow-events\"],y=t.trim,w=function(r,t){var e={};for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&-1===t.indexOf(o)&&(e[o]=r[o]);return e}(t,[\"wrap\",\"type\",\"markup\",\"components\",\"reviver\",\"onError\",\"allow-scripts\",\"allow-events\",\"trim\"]),C=v||this.reviver||this.constructor.prototype.reviver||a||r;this.setComponents(m);var g={allowScripts:d,allowEvents:h,trim:y};try{s=function(r,t,a,i,s){var u=function(r,t){var o,n,a,i,p=\"html\"===t?\"text/html\":\"application/xml\";\"html\"===t?(i=\"body\",a=\"<!DOCTYPE html>\\n<html><body>\"+r+\"</body></html>\"):(i=\"xml\",a='<?xml version=\"1.0\" encoding=\"UTF-8\"?>\\n<xml>'+r+\"</xml>\");try{o=(new DOMParser).parseFromString(a,p)}catch(r){n=r}if(o||\"html\"!==t||((o=e||(e=function(){if(document.implementation&&document.implementation.createHTMLDocument)return document.implementation.createHTMLDocument(\"\");var r=document.createElement(\"iframe\");return r.style.cssText=\"position:absolute; left:0; top:-999em; width:1px; height:1px; overflow:hidden;\",r.setAttribute(\"sandbox\",\"allow-forms\"),document.body.appendChild(r),r.contentWindow.document}())).open(),o.write(a),o.close()),o){var l=o.getElementsByTagName(i)[0],s=l.firstChild;return r&&!s&&(l.error=\"Document parse failed.\"),s&&\"parsererror\"===String(s.nodeName).toLowerCase()&&(s.removeChild(s.firstChild),s.removeChild(s.lastChild),l.error=s.textContent||s.nodeValue||n||\"Unknown error\",l.removeChild(s)),l}}(r,t);if(u&&u.error)throw new Error(u.error);var c=u&&u.body||u;l.map=i||p;var m=c&&function(r,t,e,a){return n.visitor=t,n.h=e,n.options=a||o,n(r)}(c,l,a,s);return l.map=null,m&&m.props&&m.props.children||null}(c,u,C,this.map,g)}catch(r){f?f({error:r}):\"undefined\"!=typeof console&&console.error&&console.error(\"preact-markup: \"+r)}if(!1===i)return s||null;var x=w.hasOwnProperty(\"className\")?\"className\":\"class\",b=w[x];return b?b.splice?b.splice(0,0,\"markup\"):\"string\"==typeof b?w[x]+=\" markup\":\"object\"==typeof b&&(b.markup=!0):w[x]=\"markup\",C(\"div\",w,s||null)},i}(t));\n//# sourceMappingURL=preact-markup.module.js.map\n","import { createContext, h, cloneElement } from 'preact';\nimport { useContext } from 'preact/hooks';\nimport delve from 'dlv';\nimport Markup from 'preact-markup';\n\nvar IntlContext = createContext({ intl: {} });\n\n/** Check if an object is not null or undefined\n *\t@private\n */\nfunction defined(obj) {\n\treturn obj!==null && obj!==undefined;\n}\n\n\n/** A simpler Object.assign\n * @private\n */\nfunction assign(obj, props) {\n\tfor (var i in props) {\n\t\tobj[i] = props[i];\n\t}\n\treturn obj;\n}\n\n\n/** Recursively copy keys from `source` to `target`, skipping truthy values already in `target`.\n *\t@private\n */\nfunction deepAssign(target, source) {\n\tvar out = assign({}, target);\n\tfor (var i in source) {\n\t\tif (source.hasOwnProperty(i)) {\n\t\t\tif (target[i] && source[i] && typeof target[i]==='object' && typeof source[i]==='object') {\n\t\t\t\tout[i] = deepAssign(target[i], source[i]);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tout[i] = target[i] || source[i];\n\t\t\t}\n\t\t}\n\t}\n\treturn out;\n}\n\n/** select('foo,bar') creates a mapping: `{ foo, bar }`\n *\t@private\n */\nfunction select(properties) {\n\tproperties = properties || {};\n\tif (typeof properties==='string') {\n\t\tproperties = properties.split(',');\n\t}\n\tif ('join' in properties) {\n\t\tvar selected = {};\n\t\tfor (var i=0; i<properties.length; i++) {\n\t\t\tvar val = properties[i].trim();\n\t\t\tif (val) { selected[val.split('.').pop()] = val; }\n\t\t}\n\t\treturn selected;\n\t}\n\treturn properties;\n}\n\nfunction objectWithoutProperties (obj, exclude) { var target = {}; for (var k in obj) if (Object.prototype.hasOwnProperty.call(obj, k) && exclude.indexOf(k) === -1) target[k] = obj[k]; return target; }\n\n\nvar URL_FLAG = /[?&#]intl=show/;\n\n\n/** `<IntlProvider>` is a nestable internationalization definition provider.\n *\tIt exposes an Intl scope & definition into the tree,\n *\tmaking them available to descendant components.\n *\n *\t> **Note:** When nested, gives precedence to keys higher up the tree!\n *\t> This means lower-level components can set their defaults by wrapping themselves\n *\t> in an `<IntlProvider>`, but still remain localizable by their parent components.\n *\n *\t@name IntlProvider\n *\t@param props\n *\t@param {String} [props.scope]\t\t\tNest `definition` under a root key, and set the active scope for the tree (essentially prefixing all `<Text />` keys).\n *\t@param {Boolean} [props.mark=false]\t\tIf `true`, all `<Text>` elements will be shown with a red/green background indicating whether they have valid Intl keys.\n *\t@param {Object} [props.definition={}]\tMerge the given definition into the current intl definition, giving the *current* definition precedence (i.e., only adding keys, acting as defaults)\n *\n *\t@example\n *\t// generally imported from a JSON file:\n *\tlet definition = {\n *\t\tfoo: 'Le Feux'\n *\t};\n *\n *\t<IntlProvider scope=\"weather\" definition={definition}>\n *\t\t<Text key=\"foo\">The Foo</Text>\n *\t</IntlProvider>\n *\n *\t// This will render the text:\n *\t\"Le Feux\"\n */\n\nfunction IntlProvider(ref) {\n\tvar scope = ref.scope;\n\tvar mark = ref.mark;\n\tvar definition = ref.definition;\n\tvar rest = objectWithoutProperties( ref, [\"scope\", \"mark\", \"definition\"] );\n\tvar props = rest;\n\n\tvar ref$1 = useContext(IntlContext);\n\tvar parentIntl = ref$1.intl;\n\tvar intl = assign({}, parentIntl || {});\n\n\t// set active scope for the tree if given\n\tif (scope) { intl.scope = scope; }\n\n\t// merge definition into current with lower precedence\n\tif (definition) {\n\t\tintl.dictionary = deepAssign(intl.dictionary || {}, definition);\n\t}\n\n\tif (mark || (typeof location!=='undefined' && String(location).match(URL_FLAG))) {\n\t\tintl.mark = true;\n\t}\n\n\treturn (\n\t\th( IntlContext.Provider, { value: { intl: intl } },\n\t\t\tprops.children\n\t\t)\n\t);\n}\n\n/**\n * Higher-order function that creates an `<IntlProvider />` wrapper component for the given component. It\n * takes two forms depending on how many arguments it's given:\n * It can take a functional form like:\n * intl(ComponentToWrap, options)\n *\n * or it can take an annotation form like:\n * @intl(options)\n * class ComponentToWrap extends Component {}\n *\n *\t@param {Component or Object} args[0] If there are two arguments, the first argument is the Component to wrap in `<IntlProvider/>`. If there is just one argument, this is the options object to pass as `props` to `<IntlProvider/>`. See the definition of the options param below for details.\n *\t@param {Object} options If there are two arguments, the second argument is Passed as `props` to `<IntlProvider />`\n *\t@param [options.scope]\t\t\tNest `definition` under a root key, and set the active scope for the tree (essentially prefixing all `<Text />` keys).\n *\t@param [options.definition={}]\tMerge the given definition into the current intl definition, giving the *current* definition precedence (i.e., only adding keys, acting as defaults)\n */\nfunction intl(Child, options) {\n\tif (arguments.length<2) {\n\t\toptions = Child;\n\t\treturn function (Child) { return intl(Child, options); };\n\t}\n\tfunction IntlProviderWrapper(props) {\n\t\treturn h(\n\t\t\tIntlProvider,\n\t\t\toptions || {},\n\t\t\th(Child, props)\n\t\t);\n\t}\n\n\tIntlProviderWrapper.getWrappedComponent = Child && Child.getWrappedComponent || (function () { return Child; });\n\treturn IntlProviderWrapper;\n}\n\nvar EMPTY = {};\n\n/** Populate {{template.fields}} within a given string.\n *\n *\t@private\n *\t@param {String} template\tThe string containing fields to be resolved\n *\t@param {Object} [fields={}]\tOptionally nested object of fields, referencable from `template`.\n *\t@example\n *\t\ttemplate('foo{{bar}}', { bar:'baz' }) === 'foobaz'\n */\nfunction template(template, fields, scope, dictionary) {\n\treturn template && template.replace(/\\{\\{([\\w.-]+)\\}\\}/g, replacer.bind(null, fields || EMPTY, scope, dictionary));\n}\n\n/** Replacement callback for injecting fields into a String\n *\t@private\n */\nfunction replacer(currentFields, scope, dictionary, s, field) {\n\tvar parts = field.split('.'),\n\t\tv = currentFields;\n\tfor (var i=0; i<parts.length; i++) {\n\t\tv = v[parts[i]];\n\t\tif (v == null) { return ''; } // eslint-disable-line eqeqeq\n\n\t\t//allow field values to be <Text /> nodes\n\t\tif (v && v.type === Text) {\n\t\t\treturn translate(v.props.id, scope, dictionary, v.props.fields, v.props.plural, v.props.fallback);\n\t\t}\n\t}\n\t// allow for recursive {{config.xx}} references:\n\tif (typeof v==='string' && v.match(/\\{\\{/)) {\n\t\tv = template(v, currentFields);\n\t}\n\treturn v;\n}\n\n/** Attempts to look up a translated value from a given dictionary.\n * Also supports json templating using the format: {{variable}}\n * Falls back to default text.\n *\n * @param {String} id \t\t\tIntl field name/id (subject to scope)\n * @param {String} [scope='']\t\tScope, which prefixes `id` with `${scope}.`\n * @param {Object} dictionary\t\tA nested object containing translations\n * @param {Object} [fields={}]\t\tTemplate fields for use by translated strings\n * @param {Number} [plural]\t\tIndicates a quantity, used to trigger pluralization\n * @param {String|Array} [fallback]\tText to return if no translation is found\n * @returns {String} translated\n */\nfunction translate(id, scope, dictionary, fields, plural, fallback) {\n\tif (scope) { id = scope + '.' + id; }\n\n\tvar value = dictionary && delve(dictionary, id);\n\n\t// plural forms:\n\t// key: ['plural', 'singular']\n\t// key: { none, one, many }\n\t// key: { zero, one, other }\n\t// key: { singular, plural }\n\tif ((plural || plural===0) && value && typeof value==='object') {\n\t\tif (value.splice) {\n\t\t\tvalue = value[plural] || value[0];\n\t\t}\n\t\telse if (plural===0 && defined(value.none || value.zero)) {\n\t\t\tvalue = value.none || value.zero;\n\t\t}\n\t\telse if (plural===1 && defined(value.one || value.singular)) {\n\t\t\tvalue = value.one || value.singular;\n\t\t}\n\t\telse {\n\t\t\tvalue = value.some || value.many || value.plural || value.other || value;\n\t\t}\n\t}\n\n\treturn value && template(value, fields, scope, dictionary) || fallback || null;\n}\n\n/** Highlight/colorize the i18n'd node if `mark` is set on `intl` in context. If not, just returns `value`\n *\n *\t@private\n *\t@param {String|VNode} value\tThe l10n'd text/vnode to highlight or pass through\n *\t@param {string} id\tThe key used to lookup the value in the intl dictionary\n */\nfunction HighlightI18N(ref) {\n\tvar value = ref.value;\n\tvar id = ref.id;\n\n\tvar ref$1 = useContext(IntlContext);\n\tvar intl = ref$1.intl;\n\n\tif (intl && intl.mark) {\n\t\tvar dictionaryKey = \"dictionary\" + (intl && intl.scope ? (\".\" + (intl.scope)) : '') + \".\" + id;\n\t\treturn (\n\t\t\th( 'mark', {\n\t\t\t\tstyle: {\n\t\t\t\t\tbackground: value\n\t\t\t\t\t\t? delve(intl, dictionaryKey)\n\t\t\t\t\t\t\t? 'rgba(119,231,117,.5)'\n\t\t\t\t\t\t\t: 'rgba(229,226,41,.5)'\n\t\t\t\t\t\t: 'rgba(228,147,51,.5)'\n\t\t\t\t}, title: id },\n\t\t\t\tvalue\n\t\t\t)\n\t\t);\n\t}\n\n\treturn value;\n}\n\n/** `<Text>` renders internationalized text.\n *\tIt attempts to look up translated values from a dictionary in context.\n *\n *\tTemplate strings can contain `{{field}}` placeholders,\n *\twhich injects values from the `fields` prop.\n *\n *\tWhen string lookup fails, renders its children as fallback text.\n *\n *\t@param {Object} props props\n *\t@param {String} props.id Key to look up in intl dictionary, within any parent scopes (`$scope1.$scope2.$id`)\n *\t@param {ReactElement} [props.children] Fallback text if no definition is found\n *\t@param {Object} [props.fields={}] Values to inject into template `{{fields}}`. Values in the `fields` object will be coerced to strings, with the exception of `<Text/>` nodes which will be resolved to their translated value\n *\t@param {Number} [props.plural] Integer \"count\", used to select plural forms\n *\n *\t@example\n *\t// If there is no dictionary in context..\n *\t<Text id=\"foo\">The Foo</Text>\n *\t// ..produces the text:\n *\t\"The Foo\"\n *\n *\t@example\n *\t// Given a dictionary and some fields..\n *\t<IntlProvider definition={{ foo:'Le Feux {{bar}}' }}>\n *\t\t<Text id=\"foo\" fields={{ bar: 'BEAR' }}>The Foo</Text>\n *\t</IntlProvider>\n *\t// ..produces the text:\n *\t\"Le Feux BEAR\"\n *\n *\t@example\n *\t// Within a scope, both `id` and the definition are namespaced..\n *\t<IntlProvider scope=\"weather\" definition={{ foo:'Le Feux' }}>\n *\t\t<Text id=\"foo\">The Foo</Text>\n *\t</IntlProvider>\n *\t// ..produces the text:\n *\t\"Le Feux\"\n */\nfunction Text(ref) {\n\tvar id = ref.id;\n\tvar fallback = ref.children;\n\tvar plural = ref.plural;\n\tvar fields = ref.fields;\n\n\tvar ref$1 = useContext(IntlContext);\n\tvar intl = ref$1.intl;\n\n\tvar value = translate(\n\t\tid,\n\t\tintl && intl.scope,\n\t\tintl && intl.dictionary,\n\t\tfields,\n\t\tplural,\n\t\tfallback\n\t);\n\n\treturn h( HighlightI18N, { id: id, value: value });\n}\n\n/** Translates the property values in an Object, returning a copy.\n *\t**Note:** By default, `String` keys will be treated as Intl ID's.\n *\tPass `true` to return an Object containing *only* translated\n *\tvalues where the prop is a <Text /> node.\n *\n *\t@private\n *\t@param {Object} props\tAn object with values to translate\n *\t@param {Object} intl\tAn intl context object (eg: `context.intl`)\n *\t@param {Boolean} [onlyTextNodes=false]\tOnly process `<Text />` values\n *\t@returns {Object} translatedProps\n */\nfunction translateMapping(props, intl, onlyTextNodes) {\n\tvar out = {};\n\tintl = intl || {};\n\tprops = select(props);\n\tfor (var name in props) {\n\t\tif (props.hasOwnProperty(name) && props[name]) {\n\t\t\tvar def = props[name];\n\n\t\t\t// if onlyTextNodes=true, skip any props that aren't <Text /> vnodes\n\t\t\tif (!onlyTextNodes && typeof def==='string') {\n\t\t\t\tout[name] = translate(def, intl.scope, intl.dictionary);\n\t\t\t}\n\t\t\telse if (def.type===Text) {\n\t\t\t\t// it's a <Text />, just grab its props:\n\t\t\t\tdef = assign({\n\t\t\t\t\t// use children as fallback content\n\t\t\t\t\tfallback: def.props.children\n\t\t\t\t}, def.props);\n\t\t\t\tout[name] = translate(def.id, intl.scope, intl.dictionary, def.fields, def.plural, def.fallback);\n\t\t\t}\n\t\t}\n\t}\n\treturn out;\n}\n\n/** `<Localizer />` is a Compositional Component.\n *\tIt \"renders\" out any `<Text />` values in its child's props.\n *\n *\t@name Localizer\n *\t@param {Object} props\n *\t@param {Object} props.children\tChild components with props to localize.\n *\t@param {Object} context\n *\t@param {Object} context.intl\t\t[internal] dictionary and scope info\n *\t@example\n *\t<Localizer>\n *\t\t<input placeholder={<Text id=\"username.placeholder\" />} />\n *\t</Localizer>\n *\t// produces:\n *\t<input placeholder=\"foo\" />\n *\n *\t@example\n *\t<Localizer>\n *\t\t<abbr title={<Text id=\"oss-title\">Open Source Software</Text>}>\n *\t\t\t<Text id=\"oss\">OSS</Text>\n *\t\t</abbr>\n *\t</Localizer>\n *\t// produces:\n *\t<abbr title=\"Open Source Software\">OSS</abbr>\n */\nfunction Localizer(ref) {\n\tvar children = ref.children;\n\n\tvar ref$1 = useContext(IntlContext);\n\tvar intl = ref$1.intl;\n\n\treturn children && children.length\n\t\t? children.map(function (child) { return cloneElement(child, translateMapping(child.props, intl, true)); })\n\t\t: children && cloneElement(children, translateMapping(children.props, intl, true));\n}\n\nfunction objectWithoutProperties$1 (obj, exclude) { var target = {}; for (var k in obj) if (Object.prototype.hasOwnProperty.call(obj, k) && exclude.indexOf(k) === -1) target[k] = obj[k]; return target; }\n\n/* eslint-disable react/no-danger */\n\n/** `<MarkupText>` is just like {@link Text} but it can also contain html markup in rendered strings. It wraps its contents in a `<span>` tag.\n *\n *\t@param {Object} props\t\t\t\tprops\n *\t@param {String} props.id\t\t\tKey to look up in intl dictionary, within any parent scopes (`$scope1.$scope2.$id`)\n *\t@param {Object} [props.fields={}]\tValues to inject into template `{{fields}}`. Values in the `fields` object will be coerced to strings, with the exception of `<Text/>` nodes which will be resolved to their translated value\n *\t@param {Number} [props.plural]\t\tInteger \"count\", used to select plural forms\n *\n *\t@example\n *\t// If there is no dictionary in context..\n *\t<MarkupText id=\"foo\"><b>The Foo</b></MarkupText>\n *\t// ..produces the vnode:\n *\t<span><b>The Foo</b></span>\n *\n *\t@example\n *\t// Given a dictionary and some fields..\n *\t<IntlProvider definition={{ foo:'Le Feux <b>{{bar}}</b>' }}>\n *\t\t<MarkupText id=\"foo\" fields={{ bar: 'BEAR' }}>The Foo</MarkupText>\n *\t</IntlProvider>\n *\t// ..produces the vnode:\n *\t<span>Le Feux <b>BEAR</b></span>\n *\n *\t@example\n *\t// Within a scope, both `id` and the definition are namespaced..\n *\t<IntlProvider scope=\"weather\" definition={{ foo:'Le <a href=\"http://foo.com\">Feux</a>' }}>\n *\t\t<MarkupText id=\"foo\">The Foo</MarkupText>\n *\t</IntlProvider>\n *\t// ..produces the vnode:\n *\t<span>Le <a href=\"http://foo.com\">Feux</a></span>\n *\n *\t@example\n *\t// renders nothing if there is no key match and no fallback\n *\t<div><MarkupText /></div>\n *\t// ..produces the vnode:\n *\t<div/>\n */\nfunction MarkupText(ref) {\n\tvar id = ref.id;\n\tvar fields = ref.fields;\n\tvar plural = ref.plural;\n\tvar children = ref.children;\n\tvar rest = objectWithoutProperties$1( ref, [\"id\", \"fields\", \"plural\", \"children\"] );\n\tvar props = rest;\n\n\treturn (\n\t\th( Localizer, null,\n\t\t\th( Html, Object.assign({}, { html: h( Text, { id: id, fields: fields, plural: plural, children: children }), id: id }, props))\n\t\t)\n\t);\n}\n\nfunction Html(ref) {\n\tvar html = ref.html;\n\tvar id = ref.id;\n\tvar rest = objectWithoutProperties$1( ref, [\"html\", \"id\"] );\n\tvar props = rest;\n\n\treturn (\n\t\th( HighlightI18N, {\n\t\t\tid: id, value: !html ? html : typeof html === 'string' ? h( Markup, Object.assign({}, { type: \"html\", trim: false }, props, { markup: html })) : h( 'span', null, html ) })\n\t);\n}\n\n/** `@withText()` is a Higher Order Component, often used as a decorator.\n *\n *\tIt wraps a child component and passes it translations\n *\tbased on a mapping to the dictionary & scope in context.\n *\n *\t@param {Object|Function|String} mapping\t\tMaps prop names to intl keys (or `<Text>` nodes).\n *\n *\t@example @withText({\n *\t\tplaceholder: 'user.placeholder'\n *\t})\n *\tclass Foo {\n *\t\t// now the `placeholder` prop is our localized String:\n *\t\trender({ placeholder }) {\n *\t\t\treturn <input placeholder={placeholder} />\n *\t\t}\n *\t}\n *\n *\t@example @withText({\n *\t\tplaceholder: <Text id=\"user.placeholder\">fallback text</Text>\n *\t})\n *\tclass Foo {\n *\t\trender({ placeholder }) {\n *\t\t\treturn <input placeholder={placeholder} />\n *\t\t}\n *\t}\n *\n *\t@example @withText('user.placeholder')\n *\tclass Foo {\n *\t\t// for Strings/Arrays, the last path segment becomes the prop name:\n *\t\trender({ placeholder }) {\n *\t\t\treturn <input placeholder={placeholder} />\n *\t\t}\n *\t}\n *\n *\t@example <caption>Works with functional components, too</caption>\n *\tconst Foo = withText('user.placeholder')( props =>\n *\t\t<input placeholder={props.placeholder} />\n *\t)\n *\n * \t@example <caption>getWrappedComponent() returns wrapped child Component</caption>\n *\tconst Foo = () => <div/>;\n *\tconst WrappedFoo = withText('user.placeholer')(Foo);\n *\tWrappedFoo.getWrappedComponent() === Foo; // true\n */\nfunction withText(mapping) {\n\treturn function withTextWrapper(Child) {\n\t\tfunction WithTextWrapper(props, context) {\n\t\t\tvar ref = useContext(IntlContext);\n\t\t\tvar intl = ref.intl;\n\n\t\t\tvar map = typeof mapping==='function' ? mapping(props, { intl: intl }) : mapping;\n\t\t\tvar translations = translateMapping(map, intl);\n\t\t\treturn h(Child, assign(assign({}, props), translations));\n\t\t}\n\n\t\tWithTextWrapper.getWrappedComponent = Child && Child.getWrappedComponent || (function () { return Child; });\n\t\treturn WithTextWrapper;\n\t};\n}\n\n/** `useText` is the hook version of {@link withText}\n *\n *\t@param {Object|Function|String} mapping\t\tMaps prop names to intl keys (or `<Text>` nodes).\n *\n *\t@example function MyComponent() {\n *\t\tconst { placeholder } = useText({\n *\t\t\tplaceholder: 'user.placeholder'\n *\t\t});\n *\t\treturn <input placeholder={placeholder} />\n *\t}\n *\n *\t@example function MyComponent() {\n *\t\tconst { placeholder } = useText({\n *\t\t\tplaceholder: <Text id=\"user.placeholder\">fallback text</Text>\n *\t\t});\n *\t\treturn <input placeholder={placeholder} />\n *\t}\n *\n *\t@example function MyComponent() {\n *\t\t// for Strings/Arrays, the last path segment becomes the prop name:\n *\t\tconst { placeholder } = useText('user.placeholder');\n *\n *\t\treturn <input placeholder={placeholder} />\n *\t}\n */\nfunction useText(mapping) {\n\tvar ref = useContext(IntlContext);\n\tvar intl = ref.intl;\n\n\treturn translateMapping(\n\t\ttypeof mapping==='function' ? mapping({ intl: intl }) : mapping,\n\t\tintl\n\t);\n}\n\nintl.intl = intl;\nintl.IntlContext = IntlContext;\nintl.IntlProvider = IntlProvider;\nintl.Text = Text;\nintl.MarkupText = MarkupText;\nintl.Localizer = Localizer;\nintl.withText = withText;\nintl.useText = useText;\nintl.translate = translate;\n\nexport default intl;\nexport { IntlContext, IntlProvider, Localizer, MarkupText, Text, intl, translate, useText, withText };\n//# sourceMappingURL=preact-i18n.esm.js.map\n"],"names":["delve","t","e","l","n","r","o","p","s","u","a","i","Markup","c","m","v","f","d","h","y","w","C","g","x","b","IntlContext","createContext","defined","obj","assign","props","deepAssign","target","source","out","select","properties","selected","val","objectWithoutProperties","exclude","k","URL_FLAG","IntlProvider","ref","scope","mark","definition","rest","ref$1","useContext","parentIntl","intl","Child","options","IntlProviderWrapper","EMPTY","template","fields","dictionary","replacer","currentFields","field","parts","Text","translate","id","plural","fallback","value","HighlightI18N","dictionaryKey","translateMapping","onlyTextNodes","name","def","Localizer","children","child","cloneElement","objectWithoutProperties$1","MarkupText","Html","html","withText","mapping","WithTextWrapper","context","map","translations","useText"],"mappings":"iJAAe,SAAAA,EAASC,EAAEC,EAAEC,EAAEC,EAAEC,EAAE,CAAC,IAAIH,EAAEA,EAAE,MAAMA,EAAE,MAAM,GAAG,EAAEA,EAAEE,EAAE,EAAEA,EAAEF,EAAE,OAAOE,IAAIH,EAAEA,EAAEA,EAAEC,EAAEE,CAAC,CAAC,EAAEC,EAAE,OAAOJ,IAAII,EAAEF,EAAEF,CAAC,CCAvE,IAAIC,EAAEI,GAAE,CAAA,EAAG,SAASF,EAAE,EAAE,EAAEF,EAAE,CAAC,GAAO,EAAE,WAAN,EAAe,CAAC,IAAII,EAAE,gBAAgB,EAAE,EAAE,YAAY,EAAE,WAAW,GAAG,GAAQF,EAAE,QAAQ,OAAf,GAAoB,CAAC,IAAI,EAAM,IAAJ,GAAO,IAAIF,EAAE,OAAO,EAAE,IAAI,EAAEI,EAAEA,EAAE,MAAM,YAAY,GAAWF,EAAE,QAAQ,OAAlB,MAAuB,IAAIE,EAAE,QAAQ,uBAA+BF,EAAE,QAAQ,OAAlB,OAAwB,EAAE,GAAG,GAAG,IAAUE,IAAN,MAAUJ,EAAE,OAAO,GAAG,EAAE,OAAO,IAAI,CAAC,OAAOI,CAAC,CAAC,GAAO,EAAE,WAAN,EAAe,OAAO,KAAK,IAAIC,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAa,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