@1interface/widgets 0.1.0 → 0.1.2
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/dist/{Chart.web-DQzthytj.js → Chart.web-BsL3wvUz.js} +1 -1
- package/dist/{GoogleMapsComponent-CtYLbyvO.js → GoogleMapsComponent-BRx-5AOF.js} +1 -1
- package/dist/{Markdown.web-vx2MyFJ8.js → Markdown.web-V-J_Vcrg.js} +1 -1
- package/dist/{OpenStreetMapComponent-BWRPzQtp.js → OpenStreetMapComponent-i7qWt_ga.js} +1 -1
- package/dist/{constants-D8-vgQM1.js → constants-D3e4ae6q.js} +1 -1
- package/dist/{index-DvAx4AnX.js → index-BJAzmYWE.js} +1 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.mjs +1 -1
- package/native/WidgetRenderer.js +13 -2
- package/native/WidgetRenderer.native.js +1 -1
- package/native/schema/widget-types.js +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1837,6 +1837,11 @@ export declare const TEXT_ALIGNS: {
|
|
|
1837
1837
|
readonly end: "end";
|
|
1838
1838
|
};
|
|
1839
1839
|
|
|
1840
|
+
export declare const TEXT_DIRECTIONS: {
|
|
1841
|
+
readonly ltr: "ltr";
|
|
1842
|
+
readonly rtl: "rtl";
|
|
1843
|
+
};
|
|
1844
|
+
|
|
1840
1845
|
export declare const TEXT_SIZES: {
|
|
1841
1846
|
readonly "2xs": "2xs";
|
|
1842
1847
|
readonly xs: "xs";
|
|
@@ -1875,6 +1880,8 @@ export declare type TextareaProps = {
|
|
|
1875
1880
|
allowAutofillExtensions?: boolean;
|
|
1876
1881
|
};
|
|
1877
1882
|
|
|
1883
|
+
export declare type TextDirection = (typeof TEXT_DIRECTIONS)[keyof typeof TEXT_DIRECTIONS];
|
|
1884
|
+
|
|
1878
1885
|
export declare type TextProps = {
|
|
1879
1886
|
type: "Text";
|
|
1880
1887
|
key?: string;
|
|
@@ -2438,7 +2445,7 @@ export declare interface WidgetInternalState {
|
|
|
2438
2445
|
formFields: Record<string, string>;
|
|
2439
2446
|
}
|
|
2440
2447
|
|
|
2441
|
-
export declare function WidgetRenderer({ widget, branding, brandingStyles, theme, messageId, onConsumerAction, config, errorFallback, userLocation, }: WidgetRendererProps): default_2.JSX.Element | null;
|
|
2448
|
+
export declare function WidgetRenderer({ widget, branding, brandingStyles, theme, messageId, onConsumerAction, config, errorFallback, userLocation, direction, }: WidgetRendererProps): default_2.JSX.Element | null;
|
|
2442
2449
|
|
|
2443
2450
|
export declare interface WidgetRendererProps {
|
|
2444
2451
|
widget: WidgetRoot | WidgetComponent | null;
|
|
@@ -2450,6 +2457,7 @@ export declare interface WidgetRendererProps {
|
|
|
2450
2457
|
config?: DeepPartial<RendererConfig>;
|
|
2451
2458
|
errorFallback?: ReactNode;
|
|
2452
2459
|
userLocation?: LocationCoordinates | null;
|
|
2460
|
+
direction?: TextDirection;
|
|
2453
2461
|
}
|
|
2454
2462
|
|
|
2455
2463
|
export declare type WidgetRoot = Card_2 | ListView_2 | BasicRoot_2;
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as a,m as e,B as s,n as t,o as r,p as i,C as o,q as d,t as n,v as u,w as l,x as m,D as g,y as C,z as T,F as c,E as p,G as S,I,H as x,J as A,L as F,K as R,N as W,O as E,R as N,P as O,Q as f,S as h,T as v,U as D,V as L,W as _,X as k,Y as B,Z as M,_ as U,$ as w,a0 as P,a1 as V,a2 as b,a3 as H,e as j,a4 as q,a5 as y,a6 as G,a7 as Y,a8 as z,a9 as J,e as K,e as Q,aa as X,ab as Z,f as $,ac as aa,a as ea,u as sa,ad as ta,ae as ra,af as ia,ag as oa,ah as da,ai as na}from"./index-
|
|
1
|
+
import{A as a,m as e,B as s,n as t,o as r,p as i,C as o,q as d,t as n,v as u,w as l,x as m,D as g,y as C,z as T,F as c,E as p,G as S,I,H as x,J as A,L as F,K as R,N as W,O as E,R as N,P as O,Q as f,S as h,T as v,U as D,V as L,W as _,X as k,Y as B,Z as M,_ as U,$ as w,a0 as P,a1 as V,a2 as b,a3 as H,e as j,a4 as q,a5 as y,a6 as G,a7 as Y,a8 as z,a9 as J,e as K,e as Q,aa as X,ab as Z,f as $,ac as aa,a as ea,u as sa,ad as ta,ae as ra,af as ia,ag as oa,ah as da,ai as na}from"./index-BJAzmYWE.js";import"react/jsx-runtime";import"react";export{a as ACTION_TYPES,e as ActionHandlerContext,s as Badge,t as BasicRoot,r as Box,i as Button,o as CONSUMER_ACTIONS,d as Caption,n as Card,u as Chart,l as Checkbox,m as Col,g as DEFAULT_CONFIG,C as DatePicker,T as Divider,c as FileUploadRequest,p as Form,S as FormContext,I as Icon,x as Image,A as Input,F as Label,R as ListView,W as ListViewItem,E as Markdown,N as REDUCER_ACTIONS,O as RadioGroup,f as Row,h as SELF_CONTAINED_ACTIONS,v as Select,D as Spacer,L as Text,_ as Textarea,k as Title,B as Transition,M as Video,U as WidgetErrorBoundary,w as WidgetRenderer,P as WidgetStateManager,V as WidgetStateProvider,b as WidgetThemeProvider,H as configureMap,j as defaultActionHandler,q as formatOrderItems,y as markRequiredLabels,G as mergeConfig,Y as renderWidget,z as resolveTemplate,J as safeRenderWidget,K as useAction,Q as useActionHandler,X as useFileUploadState,Z as useFormContext,$ as useMessageId,aa as useSelectedCategory,ea as useTheme,sa as useTokens,ta as useVariants,ra as useWidgetDispatch,ia as useWidgetState,oa as useWidgetTheme,da as validateFields,na as validateForm};
|
package/native/WidgetRenderer.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as c}from"react/jsx-runtime";import{useRef as T,useState as y,useEffect as H,useCallback as C}from"react";import{ThemeProvider as N,useTheme as P}from"./theme";import{WidgetStateManager as A}from"./state";import{WidgetErrorBoundary as O}from"./WidgetErrorBoundary";import{renderWidget as F}from"./runtime";import{mergeConfig as j}from"./config";import{UserLocationProvider as _}from"./components/Map";import{TEXT_DIRECTIONS as $}from"./schema";const b=390,z=24;function G(e){const t=e.match(/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})/i)??e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);if(!t)return e;const a=e.startsWith("#"),l=a?parseInt(t[1],16):Number(t[1]),d=a?parseInt(t[2],16):Number(t[2]),g=a?parseInt(t[3],16):Number(t[3]),n=.08,u=Math.round(l*(1-n)+80*n),m=Math.round(d*(1-n)+120*n),f=Math.round(g*(1-n)+200*n);return`rgb(${u}, ${m}, ${f})`}const q=`
|
|
2
2
|
[data-widget-renderer][data-widget-renderer] *,
|
|
3
3
|
[data-widget-renderer][data-widget-renderer] *::before,
|
|
4
4
|
[data-widget-renderer][data-widget-renderer] *::after {
|
|
@@ -33,4 +33,15 @@ import{jsx as l}from"react/jsx-runtime";import{useRef as C,useState as w,useEffe
|
|
|
33
33
|
-webkit-box-shadow: 0 0 0 9999px var(--widget-input-bg) inset !important;
|
|
34
34
|
-webkit-text-fill-color: var(--widget-input-fg) !important;
|
|
35
35
|
}
|
|
36
|
-
|
|
36
|
+
/* Anchor the card to the reading edge \u2014 leading in LTR, trailing in RTL. The root
|
|
37
|
+
View is its flex parent and carries an inline alignItems, so target it directly
|
|
38
|
+
with !important; mirror the two directions so LTR and RTL behave symmetrically
|
|
39
|
+
(same mechanism, opposite edge). Position only \u2014 the subtree stays ltr (outer
|
|
40
|
+
div), so contents don't mirror. */
|
|
41
|
+
[data-widget-renderer][data-widget-dir="ltr"] > * {
|
|
42
|
+
align-items: flex-start !important;
|
|
43
|
+
}
|
|
44
|
+
[data-widget-renderer][data-widget-dir="rtl"] > * {
|
|
45
|
+
align-items: flex-end !important;
|
|
46
|
+
}
|
|
47
|
+
`;let R=!1;function U(){if(R||typeof document>"u")return;if(document.getElementById("widget-renderer-style")){R=!0;return}const e=document.createElement("style");e.id="widget-renderer-style",e.textContent=q,document.head.appendChild(e),R=!0}function ae({widget:e,branding:t,brandingStyles:a,theme:l="light",messageId:d,onConsumerAction:g,config:n,errorFallback:u,userLocation:m,direction:f=$.ltr}){const p=T(null),h=T(null),[w,k]=y(1),[I,E]=y(!1),[M,D]=y(void 0),v=C(()=>{const o=p.current;if(!o)return;const r=o.clientWidth;E(s=>s?r<b+z:r<b);const i=Math.min(r<b?r/b:1,1);k(s=>Math.abs(s-i)<.005?s:i)},[]),x=C(()=>{const o=h.current;if(!o)return;const r=o.scrollHeight;D(i=>i!==void 0&&Math.abs(i-r)<1?i:r)},[]);if(H(()=>{U();const o=p.current,r=h.current;if(!o||!r)return;let i=0;const s=()=>{cancelAnimationFrame(i),i=requestAnimationFrame(()=>{v(),x()})},S=new ResizeObserver(s);S.observe(o);const W=new ResizeObserver(s);return W.observe(r),()=>{cancelAnimationFrame(i),S.disconnect(),W.disconnect()}},[v,x]),!e)return null;const L=t??a,B=j(n);return c(N,{branding:L,mode:l,config:B,children:c(A,{messageId:d,onConsumerAction:g,children:c(_,{location:m??null,children:c(V,{outerRef:p,innerRef:h,theme:l,direction:f,needsScaling:I,innerHeight:M,scale:w,errorFallback:u,widget:e})})})})}function V({outerRef:e,innerRef:t,theme:a,direction:l,needsScaling:d,innerHeight:g,scale:n,errorFallback:u,widget:m}){const{tokens:f,variants:p}=P(),h=p.input.soft.bg,w=G(h);return c("div",{ref:e,style:{direction:"ltr",width:"100%",overflow:"hidden",height:d&&g?g*n:void 0},children:c("div",{ref:t,"data-widget-renderer":"","data-widget-dir":l,"data-theme":a,style:{width:d?`${b}px`:"100%",transformOrigin:"top left",transform:d?`scale(${n})`:void 0,WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale","--widget-input-fg":f.color.text,"--widget-input-bg":w},children:c(O,{fallback:u,children:F(m)})})})}export{ae as WidgetRenderer};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e}from"react/jsx-runtime";import{View as
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{View as f}from"react-native";import{ThemeProvider as C}from"./theme";import{WidgetStateManager as W}from"./state";import{WidgetErrorBoundary as u}from"./WidgetErrorBoundary";import{renderWidget as y}from"./runtime";import{mergeConfig as R}from"./config";import{UserLocationProvider as T}from"./components/Map";import{TEXT_DIRECTIONS as r}from"./schema";function L({widget:o,branding:t,brandingStyles:i,theme:n="light",messageId:d,onConsumerAction:a,config:g,errorFallback:m,userLocation:l,direction:s=r.ltr}){if(!o)return null;const c=t??i,p=R(g);return e(C,{branding:c,mode:n,config:p,children:e(W,{messageId:d,onConsumerAction:a,children:e(T,{location:l??null,children:e(f,{style:{width:"100%",direction:"ltr",alignItems:s===r.rtl?"flex-end":"flex-start"},children:e(u,{fallback:m,children:y(o)})})})})})}export{L as WidgetRenderer};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e={Basic:"Basic",Card:"Card",ListView:"ListView",ListViewItem:"ListViewItem",Box:"Box",Row:"Row",Col:"Col",Form:"Form",Spacer:"Spacer",Divider:"Divider",Transition:"Transition",Title:"Title",Caption:"Caption",Text:"Text",Markdown:"Markdown",Badge:"Badge",Icon:"Icon",Image:"Image",Video:"Video",Button:"Button",Input:"Input",Textarea:"Textarea",Select:"Select",DatePicker:"DatePicker",Checkbox:"Checkbox",RadioGroup:"RadioGroup",Label:"Label",Chart:"Chart",FileUploadRequest:"FileUploadRequest",Map:"Map",MapMarker:"MapMarker",MapPolyline:"MapPolyline",MapCircle:"MapCircle",MapPolygon:"MapPolygon"},t={row:"row",col:"col"},o={start:"start",center:"center",end:"end",baseline:"baseline",stretch:"stretch"},
|
|
1
|
+
const e={Basic:"Basic",Card:"Card",ListView:"ListView",ListViewItem:"ListViewItem",Box:"Box",Row:"Row",Col:"Col",Form:"Form",Spacer:"Spacer",Divider:"Divider",Transition:"Transition",Title:"Title",Caption:"Caption",Text:"Text",Markdown:"Markdown",Badge:"Badge",Icon:"Icon",Image:"Image",Video:"Video",Button:"Button",Input:"Input",Textarea:"Textarea",Select:"Select",DatePicker:"DatePicker",Checkbox:"Checkbox",RadioGroup:"RadioGroup",Label:"Label",Chart:"Chart",FileUploadRequest:"FileUploadRequest",Map:"Map",MapMarker:"MapMarker",MapPolyline:"MapPolyline",MapCircle:"MapCircle",MapPolygon:"MapPolygon"},t={row:"row",col:"col"},o={ltr:"ltr",rtl:"rtl"},r={start:"start",center:"center",end:"end",baseline:"baseline",stretch:"stretch"},n={start:"start",center:"center",end:"end",between:"between",around:"around",evenly:"evenly",stretch:"stretch"},i={nowrap:"nowrap",wrap:"wrap","wrap-reverse":"wrap-reverse"},p={start:"start",center:"center",end:"end"},s={normal:"normal",medium:"medium",semibold:"semibold",bold:"bold"},a={light:"light",dark:"dark"},l={clear:"clear"},g={"2xs":"2xs",xs:"xs",sm:"sm",md:"md",lg:"lg",xl:"xl","2xl":"2xl","3xl":"3xl","4xl":"4xl",full:"full","100%":"100%",none:"none"},y={solid:"solid",dashed:"dashed",dotted:"dotted",double:"double",groove:"groove",ridge:"ridge",inset:"inset",outset:"outset"},d={cover:"cover",contain:"contain",fill:"fill","scale-down":"scale-down",none:"none"},c={"top left":"top left",top:"top","top right":"top right",left:"left",center:"center",right:"right","bottom left":"bottom left",bottom:"bottom","bottom right":"bottom right"},x={solid:"solid",soft:"soft",outline:"outline",ghost:"ghost",tabs:"tabs"},u={soft:"soft",outline:"outline"},S={"3xs":"3xs","2xs":"2xs",xs:"xs",sm:"sm",md:"md",lg:"lg",xl:"xl","2xl":"2xl","3xl":"3xl"},b={"2xs":"2xs",xs:"xs",sm:"sm",md:"md",lg:"lg",xl:"xl"},m={"2xs":"2xs",xs:"xs",sm:"sm",md:"md",lg:"lg",xl:"xl","2xl":"2xl","3xl":"3xl"},T={sm:"sm",md:"md",lg:"lg",xl:"xl","2xl":"2xl","3xl":"3xl","4xl":"4xl","5xl":"5xl"},f={sm:"sm",md:"md",lg:"lg"},I={xs:"xs",sm:"sm",md:"md",lg:"lg",xl:"xl","2xl":"2xl","3xl":"3xl",button:"button"},C={sm:"sm",md:"md",lg:"lg",xl:"xl","2xl":"2xl"},P={sm:"sm",md:"md",lg:"lg",full:"full"},E={primary:"primary",secondary:"secondary",info:"info",discovery:"discovery",success:"success",caution:"caution",warning:"warning",danger:"danger"},k={primary:"primary",secondary:"secondary"},A={primary:"primary",secondary:"secondary",success:"success",danger:"danger",warning:"warning",info:"info",discovery:"discovery"},h={solid:"solid",soft:"soft",outline:"outline"},_={sm:"sm",md:"md",lg:"lg"},O={number:"number",email:"email",text:"text",password:"password",tel:"tel",url:"url",card_number:"card_number",month_year:"month_year",cvc:"cvc",counter:"counter"},M={top:"top",bottom:"bottom",left:"left",right:"right"},R={start:"start",center:"center",end:"end"},B={auto:"auto",metadata:"metadata",none:"none"},V="auto",w={display:"display",input:"input"},N={bar:"bar",area:"area",line:"line"},D={basis:"basis",basisClosed:"basisClosed",basisOpen:"basisOpen",bumpX:"bumpX",bumpY:"bumpY",bump:"bump",linear:"linear",linearClosed:"linearClosed",natural:"natural",monotoneX:"monotoneX",monotoneY:"monotoneY",monotone:"monotone",step:"step",stepBefore:"stepBefore",stepAfter:"stepAfter"};export{r as ALIGNMENTS,A as BADGE_COLORS,_ as BADGE_SIZES,h as BADGE_VARIANTS,y as BORDER_STYLES,E as BUTTON_COLORS,C as BUTTON_ICON_SIZES,k as BUTTON_STYLE_SHORTHANDS,f as CAPTION_SIZES,P as CARD_SIZES,S as CONTROL_SIZES,x as CONTROL_VARIANTS,D as CURVE_TYPES,t as DIRECTIONS,d as FIT_MODES,s as FONT_WEIGHTS,b as GUTTER_SIZES,I as ICON_SIZES,c as IMAGE_POSITIONS,O as INPUT_TYPES,u as INPUT_VARIANTS,n as JUSTIFICATIONS,V as LIMIT_AUTO,w as MAP_MODES,R as POPOVER_ALIGNS,M as POPOVER_SIDES,B as PRELOAD_MODES,g as RADIUS_VALUES,N as SERIES_TYPES,p as TEXT_ALIGNS,o as TEXT_DIRECTIONS,m as TEXT_SIZES,a as THEME_MODES,l as TINTS,T as TITLE_SIZES,e as WIDGET_TYPES,i as WRAP_MODES};
|