streamlit-nightly 1.41.2.dev20250202__py2.py3-none-any.whl → 1.42.1.dev20250205__py2.py3-none-any.whl
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.
- streamlit/auth_util.py +2 -1
- streamlit/commands/echo.py +4 -1
- streamlit/commands/execution_control.py +3 -1
- streamlit/commands/page_config.py +2 -1
- streamlit/config.py +56 -25
- streamlit/config_option.py +3 -3
- streamlit/connections/snowflake_connection.py +22 -10
- streamlit/connections/snowpark_connection.py +2 -1
- streamlit/connections/util.py +4 -1
- streamlit/dataframe_util.py +3 -8
- streamlit/delta_generator.py +1 -1
- streamlit/elements/alert.py +32 -4
- streamlit/elements/arrow.py +28 -15
- streamlit/elements/code.py +4 -3
- streamlit/elements/deck_gl_json_chart.py +3 -4
- streamlit/elements/form.py +22 -4
- streamlit/elements/heading.py +21 -6
- streamlit/elements/image.py +12 -3
- streamlit/elements/layouts.py +9 -4
- streamlit/elements/lib/built_in_chart_utils.py +1 -3
- streamlit/elements/lib/color_util.py +7 -6
- streamlit/elements/lib/column_config_utils.py +4 -3
- streamlit/elements/lib/column_types.py +100 -33
- streamlit/elements/lib/dicttools.py +4 -1
- streamlit/elements/lib/event_utils.py +2 -2
- streamlit/elements/lib/file_uploader_utils.py +4 -1
- streamlit/elements/lib/image_utils.py +5 -4
- streamlit/elements/lib/options_selector_utils.py +4 -1
- streamlit/elements/lib/pandas_styler_utils.py +2 -1
- streamlit/elements/lib/policies.py +3 -1
- streamlit/elements/lib/utils.py +1 -1
- streamlit/elements/map.py +3 -1
- streamlit/elements/markdown.py +21 -7
- streamlit/elements/media.py +2 -2
- streamlit/elements/metric.py +8 -4
- streamlit/elements/plotly_chart.py +4 -5
- streamlit/elements/spinner.py +25 -3
- streamlit/elements/text.py +7 -2
- streamlit/elements/vega_charts.py +26 -22
- streamlit/elements/widgets/audio_input.py +8 -4
- streamlit/elements/widgets/button.py +29 -12
- streamlit/elements/widgets/button_group.py +29 -13
- streamlit/elements/widgets/camera_input.py +8 -4
- streamlit/elements/widgets/chat.py +1 -3
- streamlit/elements/widgets/checkbox.py +16 -8
- streamlit/elements/widgets/color_picker.py +8 -4
- streamlit/elements/widgets/data_editor.py +10 -14
- streamlit/elements/widgets/file_uploader.py +12 -6
- streamlit/elements/widgets/multiselect.py +10 -5
- streamlit/elements/widgets/number_input.py +8 -4
- streamlit/elements/widgets/radio.py +11 -5
- streamlit/elements/widgets/select_slider.py +12 -8
- streamlit/elements/widgets/selectbox.py +11 -5
- streamlit/elements/widgets/slider.py +19 -17
- streamlit/elements/widgets/text_widgets.py +16 -8
- streamlit/elements/widgets/time_widgets.py +21 -15
- streamlit/elements/write.py +60 -43
- streamlit/errors.py +1 -2
- streamlit/external/langchain/streamlit_callback_handler.py +3 -3
- streamlit/hello/animation_demo.py +1 -1
- streamlit/material_icon_names.py +1 -1
- streamlit/proto/NewSession_pb2.py +16 -16
- streamlit/proto/NewSession_pb2.pyi +30 -3
- streamlit/runtime/app_session.py +15 -15
- streamlit/runtime/caching/cached_message_replay.py +2 -1
- streamlit/runtime/caching/hashing.py +3 -2
- streamlit/runtime/context.py +2 -1
- streamlit/runtime/forward_msg_cache.py +3 -1
- streamlit/runtime/memory_session_storage.py +4 -1
- streamlit/runtime/memory_uploaded_file_manager.py +4 -1
- streamlit/runtime/runtime.py +6 -4
- streamlit/runtime/scriptrunner/script_runner.py +4 -3
- streamlit/runtime/scriptrunner_utils/script_run_context.py +2 -3
- streamlit/runtime/secrets.py +1 -5
- streamlit/runtime/state/common.py +2 -4
- streamlit/runtime/state/query_params.py +2 -1
- streamlit/runtime/state/query_params_proxy.py +2 -1
- streamlit/runtime/state/safe_session_state.py +3 -1
- streamlit/runtime/state/session_state.py +2 -5
- streamlit/runtime/state/session_state_proxy.py +2 -1
- streamlit/runtime/uploaded_file_manager.py +3 -1
- streamlit/runtime/websocket_session_manager.py +8 -8
- streamlit/static/index.html +2 -2
- streamlit/static/static/css/{index.mUTQuMqR.css → index.DpJG_94W.css} +1 -1
- streamlit/static/static/js/{FileDownload.esm.Cf3bITtP.js → FileDownload.esm.ShSIWsKj.js} +1 -1
- streamlit/static/static/js/FileDropzone.BFkJKygp.js +5 -0
- streamlit/static/static/js/{FormClearHelper.BgwPD1tD.js → FormClearHelper.Bue0QSIn.js} +1 -1
- streamlit/static/static/js/{Hooks.BMaXaj11.js → Hooks.kV16_k1-.js} +1 -1
- streamlit/static/static/js/{InputInstructions.qlsk9gvt.js → InputInstructions.DpG38kbY.js} +1 -1
- streamlit/static/static/js/ProgressBar.B_WJAIyy.js +2 -0
- streamlit/static/static/js/{RenderInPortalIfExists.Blpdplqk.js → RenderInPortalIfExists.CGAGPcQq.js} +1 -1
- streamlit/static/static/js/{Toolbar.DMhyNpv2.js → Toolbar.DBtrI961.js} +1 -1
- streamlit/static/static/js/axios.upsvKRUO.js +6 -0
- streamlit/static/static/js/{base-input.DyTEaESI.js → base-input.P8VGAZdC.js} +4 -4
- streamlit/static/static/js/{createSuper.B3rIhdpQ.js → createSuper.GYQHnroV.js} +1 -1
- streamlit/static/static/js/{data-grid-overlay-editor.C9Q9Gy4e.js → data-grid-overlay-editor.B1sLTR3f.js} +1 -1
- streamlit/static/static/js/{downloader.BAMiKd1n.js → downloader.y-Ssi2d3.js} +1 -1
- streamlit/static/static/js/{es6.D82pr6dy.js → es6.DpUKmjxe.js} +2 -2
- streamlit/static/static/js/{iframeResizer.contentWindow.CJwxqR7x.js → iframeResizer.contentWindow.BBjdpeP0.js} +1 -1
- streamlit/static/static/js/{index.zlHOKWDA.js → index.2bJmI0Ih.js} +1 -1
- streamlit/static/static/js/{index.CjFbbEE0.js → index.3k422wEU.js} +1 -1
- streamlit/static/static/js/{index.P5kx9um8.js → index.B11A7C7I.js} +5 -5
- streamlit/static/static/js/{index.DiZyaYeV.js → index.B7AJyWjy.js} +3 -3
- streamlit/static/static/js/index.B7aeIxns.js +1 -0
- streamlit/static/static/js/index.BRsob9Jp.js +1 -0
- streamlit/static/static/js/{index.BLCqXxIG.js → index.BVkJfCWM.js} +1 -1
- streamlit/static/static/js/{index.B3Wxz7wG.js → index.BW_6EVtw.js} +1 -1
- streamlit/static/static/js/index.Bkk4sBLz.js +1 -0
- streamlit/static/static/js/{index.BcAjRRAZ.js → index.BqiT_qyM.js} +1 -1
- streamlit/static/static/js/index.C-BkiutF.js +1 -0
- streamlit/static/static/js/{index.C4kPuKr4.js → index.C73Hi-mL.js} +1 -1
- streamlit/static/static/js/{index.BM_J1KkD.js → index.C8vyFGOc.js} +1 -1
- streamlit/static/static/js/{index.CF4stbIZ.js → index.CAQGqUJ5.js} +1 -1
- streamlit/static/static/js/index.CC_i5fnL.js +3 -0
- streamlit/static/static/js/index.CIkzV9zP.js +2 -0
- streamlit/static/static/js/index.CIwUls4J.js +1 -0
- streamlit/static/static/js/{index.TPHsScPF.js → index.CUzW8sZB.js} +1 -1
- streamlit/static/static/js/index.CVIsVMt0.js +1 -0
- streamlit/static/static/js/{index.yp4f0OMe.js → index.CZFA90VV.js} +2 -2
- streamlit/static/static/js/{index.5JFTbX2J.js → index.Cd8_b4vi.js} +1 -1
- streamlit/static/static/js/{index.BdEYCAFh.js → index.CoJayF2l.js} +1 -1
- streamlit/static/static/js/index.Cp60C2LQ.js +1 -0
- streamlit/static/static/js/index.D-Qsohh0.js +1 -0
- streamlit/static/static/js/index.D2i6l9uv.js +1 -0
- streamlit/static/static/js/{index.BZvQkTCS.js → index.D3PlNa4T.js} +1 -1
- streamlit/static/static/js/{index.8Q56Jjmk.js → index.D7HtU_R4.js} +1 -1
- streamlit/static/static/js/{index.BdlaxG49.js → index.DHOnt3Rd.js} +1 -1
- streamlit/static/static/js/index.DNKGONSt.js +1 -0
- streamlit/static/static/js/{index.Y84nTPW2.js → index.D_CViY1G.js} +1 -1
- streamlit/static/static/js/{index.D9yF6cxC.js → index.DdJR-Re7.js} +1 -1
- streamlit/static/static/js/index.DdaoJ1WZ.js +73 -0
- streamlit/static/static/js/{index.CoE1gpPQ.js → index.DsOZJLyF.js} +1 -1
- streamlit/static/static/js/{index.B7J6suR-.js → index.DuqdUleB.js} +200 -200
- streamlit/static/static/js/{index.NbimJbgq.js → index.GZ99DH1Q.js} +6 -6
- streamlit/static/static/js/{index.CC5oiyoV.js → index.OWYUy0bC.js} +2 -2
- streamlit/static/static/js/index.USVf5VUT.js +1 -0
- streamlit/static/static/js/{input.DRyjjTTH.js → input.BANuQoGH.js} +2 -2
- streamlit/static/static/js/{memory.C98yjNkk.js → memory.DTxlMbK7.js} +1 -1
- streamlit/static/static/js/{mergeWith.CLihEflw.js → mergeWith.CfihrnQo.js} +1 -1
- streamlit/static/static/js/{number-overlay-editor.DozQhDJj.js → number-overlay-editor.BHsEp8VL.js} +1 -1
- streamlit/static/static/js/{possibleConstructorReturn.DJ7-JsJc.js → possibleConstructorReturn.BErM7qST.js} +1 -1
- streamlit/static/static/js/{sandbox.0Tj4C46D.js → sandbox.BMuVLu80.js} +1 -1
- streamlit/static/static/js/{textarea.CUrV8-V3.js → textarea.CmSZv6UE.js} +2 -2
- streamlit/static/static/js/{timepicker.DEu3fwJe.js → timepicker.DsaAj0da.js} +4 -4
- streamlit/static/static/js/{toConsumableArray.C71OtXzK.js → toConsumableArray.DJs7oxRq.js} +1 -1
- streamlit/static/static/js/{uniqueId.CndDhnid.js → uniqueId.CVe3uxKs.js} +1 -1
- streamlit/static/static/js/useBasicWidgetState.D572sX2t.js +1 -0
- streamlit/static/static/js/{useOnInputChange.CvHbHWmy.js → useOnInputChange.D9rTVyjn.js} +1 -1
- streamlit/static/static/js/{withFullScreenWrapper.BLLyDFUF.js → withFullScreenWrapper.4QDrgZxA.js} +1 -1
- streamlit/static/static/media/MaterialSymbols-Rounded.DcZbplWk.woff2 +0 -0
- streamlit/testing/v1/app_test.py +3 -1
- streamlit/testing/v1/element_tree.py +3 -4
- streamlit/testing/v1/local_script_runner.py +3 -3
- streamlit/type_util.py +11 -8
- streamlit/user_info.py +2 -3
- streamlit/watcher/path_watcher.py +4 -4
- streamlit/web/server/authlib_tornado_integration.py +3 -1
- streamlit/web/server/browser_websocket_handler.py +3 -1
- streamlit/web/server/routes.py +4 -1
- streamlit/web/server/server.py +2 -1
- {streamlit_nightly-1.41.2.dev20250202.dist-info → streamlit_nightly-1.42.1.dev20250205.dist-info}/METADATA +1 -2
- {streamlit_nightly-1.41.2.dev20250202.dist-info → streamlit_nightly-1.42.1.dev20250205.dist-info}/RECORD +166 -165
- streamlit/static/static/js/FileDropzone.B8wCqKiM.js +0 -5
- streamlit/static/static/js/ProgressBar.Di2oT-20.js +0 -2
- streamlit/static/static/js/index.B79cf7gS.js +0 -1
- streamlit/static/static/js/index.BBPZ3wsr.js +0 -1
- streamlit/static/static/js/index.BKahTKEx.js +0 -3
- streamlit/static/static/js/index.CSGfgCnQ.js +0 -1
- streamlit/static/static/js/index.CYMgsYSm.js +0 -1
- streamlit/static/static/js/index.CZjnqbcd.js +0 -73
- streamlit/static/static/js/index.C_4BuzGH.js +0 -1
- streamlit/static/static/js/index.CjiPq39N.js +0 -1
- streamlit/static/static/js/index.CjuTYYFG.js +0 -1
- streamlit/static/static/js/index.CqGcWpm5.js +0 -2
- streamlit/static/static/js/index.CuH7mftz.js +0 -1
- streamlit/static/static/js/index.DFJg1zHB.js +0 -1
- streamlit/static/static/js/index.Dm3nmdhh.js +0 -1
- streamlit/static/static/js/index.rrDohWOh.js +0 -1
- streamlit/static/static/js/useBasicWidgetState.DXLMTaiS.js +0 -1
- streamlit/static/static/media/MaterialSymbols-Rounded.DzyB5T7Y.woff2 +0 -0
- {streamlit_nightly-1.41.2.dev20250202.data → streamlit_nightly-1.42.1.dev20250205.data}/scripts/streamlit.cmd +0 -0
- {streamlit_nightly-1.41.2.dev20250202.dist-info → streamlit_nightly-1.42.1.dev20250205.dist-info}/WHEEL +0 -0
- {streamlit_nightly-1.41.2.dev20250202.dist-info → streamlit_nightly-1.42.1.dev20250205.dist-info}/entry_points.txt +0 -0
- {streamlit_nightly-1.41.2.dev20250202.dist-info → streamlit_nightly-1.42.1.dev20250205.dist-info}/top_level.txt +0 -0
@@ -1 +0,0 @@
|
|
1
|
-
import{n as z,r as a,y as R,cs as I,z as U,j as u,bt as k,bG as H,bu as L,bd as B,bv as D,cu as j}from"./index.B7J6suR-.js";import{u as O}from"./uniqueId.CndDhnid.js";import{u as _,a as G,b as K}from"./useOnInputChange.CvHbHWmy.js";import{a as q}from"./useBasicWidgetState.DXLMTaiS.js";import{I as A}from"./InputInstructions.qlsk9gvt.js";import{I as N}from"./input.DRyjjTTH.js";import"./inputUtils.CQWz5UKz.js";import"./FormClearHelper.BgwPD1tD.js";import"./base-input.DyTEaESI.js";const $=z("div",{target:"e1sommdr0"})(({width:e})=>({position:"relative",width:e}));function rt({disabled:e,element:t,widgetMgr:s,width:n,fragmentId:m}){var g;const[r,l]=a.useState(S(s,t)??null),[i,d]=a.useState(!1),W=a.useCallback(()=>{l(t.default??null),d(!0)},[t.default]),[y,p]=q({getStateFromWidgetMgr:S,getDefaultStateFromProto:w,getCurrStateFromProto:J,updateWidgetMgrState:Q,element:t,widgetMgr:s,fragmentId:m,onFormCleared:W});_(y,r,l,i);const[T,h]=a.useState(!1),o=R(),[b]=a.useState(()=>O("text_input_")),{placeholder:x,formId:f}=t,c=a.useCallback(()=>{d(!1),p({value:r,fromUi:!0})},[r,p]),C=I({formId:f})?s.allowFormEnterToSubmit(f):i,V=T&&n>o.breakpoints.hideWidgetDetails,F=a.useCallback(()=>{i&&c(),h(!1)},[i,c]),v=a.useCallback(()=>{h(!0)},[]),E=G({formId:t.formId,maxChars:t.maxChars,setDirty:d,setUiValue:l,setValueWithSource:p}),P=K(t.formId,c,i,s,m);return U($,{className:"stTextInput","data-testid":"stTextInput",width:n,children:[u(D,{label:t.label,disabled:e,labelVisibility:k((g=t.labelVisibility)==null?void 0:g.value),htmlFor:b,children:t.help&&u(H,{children:u(L,{content:t.help,placement:B.TOP_RIGHT})})}),u(N,{value:r??"",placeholder:x,onBlur:F,onFocus:v,onChange:E,onKeyPress:P,"aria-label":t.label,disabled:e,id:b,type:X(t),autoComplete:t.autocomplete,overrides:{Input:{style:{minWidth:0,"::placeholder":{opacity:"0.7"},lineHeight:o.lineHeights.inputWidget,paddingRight:o.spacing.sm,paddingLeft:o.spacing.sm,paddingBottom:o.spacing.sm,paddingTop:o.spacing.sm}},Root:{props:{"data-testid":"stTextInputRootElement"},style:{height:o.sizes.minElementHeight,borderLeftWidth:o.sizes.borderWidth,borderRightWidth:o.sizes.borderWidth,borderTopWidth:o.sizes.borderWidth,borderBottomWidth:o.sizes.borderWidth}}}}),V&&u(A,{dirty:i,value:r??"",maxLength:t.maxChars,inForm:I({formId:t.formId}),allowEnterToSubmit:C})]})}function S(e,t){return e.getStringValue(t)??null}function w(e){return e.default??null}function J(e){return e.value??null}function Q(e,t,s,n){t.setStringValue(e,s.value,{fromUi:s.fromUi},n)}function X(e){return e.type===j.Type.PASSWORD?"password":"text"}export{rt as default};
|
@@ -1,2 +0,0 @@
|
|
1
|
-
import{bx as Z,by as J,r as f,bz as Q,y as Y,bA as s,j as S,z as ee,bt as te,bB as re,bC as ne,bu as oe,bd as ie,bv as ae,br as ue,b9 as j,b8 as W,bb as le}from"./index.B7J6suR-.js";import{a as ce}from"./useBasicWidgetState.DXLMTaiS.js";import"./FormClearHelper.BgwPD1tD.js";var se={primary:"primary",secondary:"secondary",tertiary:"tertiary"},G={default:"default",pill:"pill",round:"round",circle:"circle",square:"square"},fe={mini:"mini",default:"default",compact:"compact",large:"large"},P=Object.freeze({radio:"radio",checkbox:"checkbox"}),z=Z("div",function(e){var t=e.$shape,r=e.$length,n=e.$theme,o=r===1?void 0:t!==G.default?"-".concat(n.sizing.scale100):"-0.5px";return{display:"flex",marginLeft:o,marginRight:o}});z.displayName="StyledRoot";z.displayName="StyledRoot";function D(e){"@babel/helpers - typeof";return D=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},D(e)}function M(){return M=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},M.apply(this,arguments)}function x(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function pe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?x(Object(r),!0).forEach(function(n){N(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):x(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function de(e,t){return he(e)||me(e,t)||be(e,t)||ye()}function ye(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
2
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function be(e,t){if(e){if(typeof e=="string")return X(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return X(e,t)}}function X(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function me(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],o=!0,i=!1,a,p;try{for(r=r.call(e);!(o=(a=r.next()).done)&&(n.push(a.value),!(t&&n.length===t));o=!0);}catch(c){i=!0,p=c}finally{try{!o&&r.return!=null&&r.return()}finally{if(i)throw p}}return n}}function he(e){if(Array.isArray(e))return e}function ge(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ve(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Se(e,t,r){return t&&ve(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Oe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&$(e,t)}function $(e,t){return $=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},$(e,t)}function _e(e){var t=we();return function(){var n=k(e),o;if(t){var i=k(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return Ee(this,o)}}function Ee(e,t){if(t&&(D(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return K(e)}function K(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function we(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function k(e){return k=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},k(e)}function N(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Le(e,t){return!Array.isArray(e)&&typeof e!="number"?!1:Array.isArray(e)?e.includes(t):e===t}var F=function(e){Oe(r,e);var t=_e(r);function r(){var n;ge(this,r);for(var o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return n=t.call.apply(t,[this].concat(i)),N(K(n),"childRefs",{}),n}return Se(r,[{key:"render",value:function(){var o=this,i=this.props,a=i.overrides,p=a===void 0?{}:a,c=i.mode,C=c===void 0?P.checkbox:c,d=i.children,y=i.selected,m=i.disabled,l=i.onClick,E=i.kind,h=i.shape,w=i.size,A=J(p.Root,z),O=de(A,2),_=O[0],L=O[1],H=this.props["aria-label"]||this.props.ariaLabel,g=C===P.radio,V=f.Children.count(d);return f.createElement(Q.Consumer,null,function(q){return f.createElement(_,M({"aria-label":H||q.buttongroup.ariaLabel,"data-baseweb":"button-group",role:g?"radiogroup":"group",$shape:h,$length:d.length},L),f.Children.map(d,function(b,R){if(!f.isValidElement(b))return null;var B=b.props.isSelected?b.props.isSelected:Le(y,R);return g&&(o.childRefs[R]=f.createRef()),f.cloneElement(b,{disabled:m||b.props.disabled,isSelected:B,ref:g?o.childRefs[R]:void 0,tabIndex:!g||B||g&&(!y||y===-1)&&R===0?0:-1,onKeyDown:function(u){if(g){var v=Number(y)?Number(y):0;if(u.key==="ArrowUp"||u.key==="ArrowLeft"){u.preventDefault&&u.preventDefault();var I=v-1<0?V-1:v-1;l&&l(u,I),o.childRefs[I].current&&o.childRefs[I].current.focus()}if(u.key==="ArrowDown"||u.key==="ArrowRight"){u.preventDefault&&u.preventDefault();var T=v+1>V-1?0:v+1;l&&l(u,T),o.childRefs[T].current&&o.childRefs[T].current.focus()}}},kind:E,onClick:function(u){m||(b.props.onClick&&b.props.onClick(u),l&&l(u,R))},shape:h,size:w,overrides:pe({BaseButton:{style:function(u){var v=u.$theme;return d.length===1?{}:h!==G.default?{marginLeft:v.sizing.scale100,marginRight:v.sizing.scale100}:{marginLeft:"0.5px",marginRight:"0.5px"}},props:{"aria-checked":B,role:g?"radio":"checkbox"}}},b.props.overrides)})}))})}}]),r}(f.Component);N(F,"defaultProps",{disabled:!1,onClick:function(){},shape:G.default,size:fe.default,kind:se.secondary});function Re(e,t){return t.includes(e)?t.filter(r=>r!==e):[...t,e]}function Ce(e,t,r){return e==s.ClickMode.MULTI_SELECT?Re(t,r??[]):r!=null&&r.includes(t)?[]:[t]}function Pe(e){return e.length===0?-1:e[0]}function ke(e,t,r,n){t.setIntArrayValue(e,r.value,{fromUi:r.fromUi},n)}function Ae(e,t,r){const n=r===s.Style.PILLS?j.PILLS:r===s.Style.BORDERLESS?j.BORDERLESS_ICON:j.SEGMENTED_CONTROL,o=r===s.Style.BORDERLESS?W.XSMALL:W.MEDIUM,i=r===s.Style.BORDERLESS?"lg":"base";return{element:S(le,{icon:t,label:e,iconSize:i}),kind:n,size:o}}function Be(e,t,r,n){return r.indexOf(n)>-1?!0:t!==s.ClickMode.SINGLE_SELECT||e!==s.SelectionVisualization.ALL_UP_TO_SELECTED?!1:r.length>0&&n<r[0]}function Ie(e,t){return e&&(t=`${t}Active`),t}function Te(e,t){const r={flexWrap:"wrap",maxWidth:"fit-content"};switch(e){case s.Style.BORDERLESS:return{...r,columnGap:t.threeXS,rowGap:t.threeXS};case s.Style.PILLS:return{...r,columnGap:t.twoXS,rowGap:t.twoXS};case s.Style.SEGMENTED_CONTROL:return{...r,columnGap:t.none,rowGap:t.twoXS,"::after":{content:"''",flex:1e4}};default:return r}}function je(e,t,r,n,o,i){const a=Be(r,n,o,t);let p=e.content,c=e.contentIcon;return a&&(p=e.selectedContent?e.selectedContent:p,c=e.selectedContentIcon?e.selectedContentIcon:c),f.forwardRef(function(d,y){const{element:m,kind:l,size:E}=Ae(p??"",c??void 0,i),h=Ie(!!(a&&!e.selectedContent&&!e.selectedContentIcon),l);return S(ue,{...d,size:E,kind:h,children:m})})}function De(e,t){return e.getIntArrayValue(t)}function Me(e){return e.default??null}function $e(e){return e.value??null}function Ge(e){const{disabled:t,element:r,fragmentId:n,widgetMgr:o}=e,{clickMode:i,options:a,selectionVisualization:p,style:c,label:C,labelVisibility:d,help:y}=r,m=Y(),[l,E]=ce({getStateFromWidgetMgr:De,getDefaultStateFromProto:Me,getCurrStateFromProto:$e,updateWidgetMgrState:ke,element:r,widgetMgr:o,fragmentId:n}),h=(O,_)=>{const L=Ce(i,_,l);E({value:L,fromUi:!0})};let w;i===s.ClickMode.SINGLE_SELECT?w=P.radio:i===s.ClickMode.MULTI_SELECT&&(w=P.checkbox);const A=f.useMemo(()=>a.map((O,_)=>{const L=je(O,_,p,i,l,c);return S(L,{},`${O.content}-${_}`)}),[i,a,p,c,l]);return ee("div",{className:"stButtonGroup","data-testid":"stButtonGroup",children:[S(ae,{label:C,disabled:t,labelVisibility:te((d==null?void 0:d.value)??re.LabelVisibilityOptions.COLLAPSED),children:y&&S(ne,{children:S(oe,{content:y,placement:ie.TOP})})}),S(F,{disabled:t,mode:w,onClick:h,selected:i===s.ClickMode.MULTI_SELECT?l:Pe(l),overrides:{Root:{style:f.useCallback(()=>Te(c,m.spacing),[c,m.spacing])}},children:A})]})}const Ue=f.memo(Ge);export{Ue as default};
|
@@ -1 +0,0 @@
|
|
1
|
-
import{r as s,J as d,j as S,bt as x,c7 as U}from"./index.B7J6suR-.js";import{a as V}from"./useBasicWidgetState.DXLMTaiS.js";import"./FormClearHelper.BgwPD1tD.js";const v=(t,e)=>t.getIntValue(e),h=t=>t.default??null,C=t=>t.value??null,F=(t,e,o,a)=>{e.setIntValue(t,o.value,{fromUi:o.fromUi},a)},I=({disabled:t,element:e,widgetMgr:o,width:a,fragmentId:u})=>{const{options:n,help:c,label:i,labelVisibility:r,placeholder:m}=e,[f,l]=V({getStateFromWidgetMgr:v,getDefaultStateFromProto:h,getCurrStateFromProto:C,updateWidgetMgrState:F,element:e,widgetMgr:o,fragmentId:u}),g=s.useCallback(b=>{l({value:b,fromUi:!0})},[l]),p=d(e.default)&&!t;return S(U,{label:i,labelVisibility:x(r==null?void 0:r.value),options:n,disabled:t,width:a,onChange:g,value:f,help:c,placeholder:m,clearable:p})},E=s.memo(I);export{E as default};
|
@@ -1 +0,0 @@
|
|
1
|
-
import{n as a,bo as S,i as x,R as p,aF as f,c5 as g,j as i,c6 as m,z as T,aE as $}from"./index.B7J6suR-.js";const h=a(S,{shouldForwardProp:x,target:"e1ira7tx0"})(({theme:e,usingCustomTheme:s})=>({fontSize:e.fontSizes.sm,width:e.sizes.spinnerSize,height:e.sizes.spinnerSize,borderWidth:e.sizes.spinnerThickness,radius:e.radii.md,justifyContents:"center",padding:e.spacing.none,margin:e.spacing.none,borderColor:e.colors.borderColor,borderTopColor:s?e.colors.primary:e.colors.blue70,flexGrow:0,flexShrink:0})),b=a("div",{target:"e1ira7tx1"})(({theme:e,width:s,cache:t})=>({width:s,...t?{paddingBottom:e.spacing.lg,background:`linear-gradient(to bottom, ${e.colors.bgColor} 0%, ${e.colors.bgColor} 80%, transparent 100%)`}:null})),C=a("div",{target:"e1ira7tx2"})(({theme:e})=>({opacity:.6,fontSize:e.fontSizes.sm})),y=a("div",{target:"e1ira7tx3"})(({theme:e})=>({display:"flex",gap:e.spacing.sm,alignItems:"center",width:"100%"})),z=e=>{const s=Math.floor(e/3600),t=Math.floor(e%3600/60),n=e%60;if(s===0&&t===0)return`(${n.toFixed(1)} seconds)`;if(s===0){const l=`${t} minute${t===1?"":"s"}`,d=n===0?"":`, ${n.toFixed(1)} seconds`;return`(${l}${d})`}const o=`${s} hour${s===1?"":"s"}`,r=t===0?"":`, ${t} minute${t===1?"":"s"}`,c=n===0?"":`, ${n.toFixed(1)} seconds`;return`(${o}${r}${c})`};function v({width:e,element:s}){const{activeTheme:t}=p.useContext(f),n=!g(t),{cache:o,showTime:r}=s,[c,l]=p.useState(0);return p.useEffect(()=>{if(!r)return;const d=setInterval(()=>{l(u=>u+.1)},100);return()=>clearInterval(d)},[r]),i(b,{className:m({stSpinner:!0,stCacheSpinner:o}),"data-testid":"stSpinner",width:e,cache:o,children:T(y,{children:[i(h,{usingCustomTheme:n}),i($,{source:s.text,allowHTML:!1}),r&&i(C,{children:z(c)})]})})}export{v as default};
|
@@ -1 +0,0 @@
|
|
1
|
-
import{r as o,E as K,_ as X,n as x,aR as lt,al as ut,cs as ct,M as J,cD as I,J as f,z,j as c,bt as dt,bG as pt,bu as ft,bd as bt,bv as gt,bq as G}from"./index.B7J6suR-.js";import{s as mt}from"./sprintf.C-r3gIuM.js";import{u as yt}from"./uniqueId.CndDhnid.js";import{u as It}from"./FormClearHelper.BgwPD1tD.js";import{I as ht}from"./InputInstructions.qlsk9gvt.js";import{I as wt}from"./input.DRyjjTTH.js";import"./base-input.DyTEaESI.js";var Q=o.forwardRef(function(t,e){var r={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return o.createElement(K,X({iconAttrs:r,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},t,{ref:e}),o.createElement("path",{d:"M0 3v2h8V3H0z"}))});Q.displayName="Minus";var Y=o.forwardRef(function(t,e){var r={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return o.createElement(K,X({iconAttrs:r,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},t,{ref:e}),o.createElement("path",{d:"M3 0v3H0v2h3v3h2V5h3V3H5V0H3z"}))});Y.displayName="Plus";const Ct=x("div",{target:"eiawb8t0"})(({theme:t})=>({display:"flex",flexDirection:"row",flexWrap:"nowrap",alignItems:"center",height:t.sizes.minElementHeight,borderWidth:t.sizes.borderWidth,borderStyle:"solid",borderColor:t.colors.widgetBorderColor||t.colors.widgetBackgroundColor||t.colors.bgColor,transitionDuration:"200ms",transitionProperty:"border",transitionTimingFunction:"cubic-bezier(0.2, 0.8, 0.4, 1)",borderRadius:t.radii.default,overflow:"hidden","&.focused":{borderColor:t.colors.primary},input:{MozAppearance:"textfield","&::-webkit-inner-spin-button, &::-webkit-outer-spin-button":{WebkitAppearance:"none",margin:t.spacing.none}}})),Tt=x("div",{target:"eiawb8t1"})({display:"flex",flexDirection:"row",alignSelf:"stretch"}),M=x("button",{target:"eiawb8t2"})(({theme:t})=>({margin:t.spacing.none,border:"none",height:t.sizes.full,display:"flex",alignItems:"center",width:t.sizes.numberInputControlsWidth,justifyContent:"center",color:t.colors.bodyText,transition:"color 300ms, backgroundColor 300ms",backgroundColor:t.colors.widgetBackgroundColor||t.colors.secondaryBg,"&:hover:enabled, &:focus:enabled":{color:t.colors.white,backgroundColor:t.colors.primary,transition:"none",outline:"none"},"&:active":{outline:"none",border:"none"},"&:last-of-type":{borderTopRightRadius:t.radii.default,borderBottomRightRadius:t.radii.default},"&:disabled":{cursor:"not-allowed",color:t.colors.fadedText40}})),vt=x("div",{target:"eiawb8t3"})(({theme:t,clearable:e})=>({position:"absolute",marginRight:t.spacing.twoXS,left:0,right:`calc(${t.sizes.numberInputControlsWidth} * 2 + ${e?"1em":"0em"})`})),St=ut.getLogger("NumberInput");function Vt(t){return f(t)||t===""?void 0:t}const kt=t=>(t.element.dataType===I.DataType.INT?t.widgetMgr.getIntValue(t.element):t.widgetMgr.getDoubleValue(t.element))??t.element.default??null,q=({step:t,dataType:e})=>t||(e===I.DataType.INT?1:.01),W=({value:t,format:e,step:r,dataType:h})=>{if(f(t))return null;let a=Vt(e);if(f(a)&&J(r)){const l=r.toString();h===I.DataType.FLOAT&&r!==0&&l.includes(".")&&(a=`%0.${l.split(".")[1].length}f`)}if(f(a))return t.toString();try{return mt.sprintf(a,t)}catch(l){return St.warn(`Error in sprintf(${a}, ${t}): ${l}`),String(t)}},xt=(t,e,r)=>f(t)?!1:t-e>=r,Dt=(t,e,r)=>f(t)?!1:t+e<=r,Rt=({disabled:t,element:e,widgetMgr:r,width:h,theme:a,fragmentId:l})=>{var j;const{dataType:T,id:D,formId:p,default:B,format:U}=e,b=e.hasMin?e.min:-1/0,g=e.hasMax?e.max:1/0,[s,Z]=o.useState(q(e)),A=kt({element:e,widgetMgr:r}),[m,w]=o.useState(!1),[i,C]=o.useState(A),[H,v]=o.useState(W({value:A,...e,step:s})),[P,$]=o.useState(!1),R=o.useRef(null),L=o.useRef(yt("number_input_")),S=xt(i,s,b),V=Dt(i,s,g),O=ct({formId:p}),tt=O?r.allowFormEnterToSubmit(p):m,et=P&&h>a.breakpoints.hideWidgetDetails;o.useEffect(()=>{Z(q({step:e.step,dataType:e.dataType}))},[e.dataType,e.step]);const u=o.useCallback(({value:n,source:d})=>{var y;if(J(n)&&(b>n||n>g))(y=R.current)==null||y.reportValidity();else{const k=n??B??null;switch(T){case I.DataType.INT:r.setIntValue({id:D,formId:p},k,d,l);break;case I.DataType.FLOAT:r.setDoubleValue({id:D,formId:p},k,d,l);break;default:throw new Error("Invalid data type")}w(!1),C(k),v(W({value:k,dataType:T,format:U,step:s}))}},[b,g,R,r,l,s,T,D,p,B,U]),ot=o.useCallback(()=>{m&&u({value:i,source:{fromUi:!0}}),$(!1)},[m,i,u]),rt=o.useCallback(()=>{$(!0)},[]),_=o.useCallback(()=>{const{value:n}=e;e.setValue=!1,C(n??null),v(W({value:n??null,...e,step:s})),u({value:n??null,source:{fromUi:!1}})},[e,s,u]);o.useEffect(()=>{e.setValue?_():u({value:i,source:{fromUi:!1}})},[]),e.setValue&&_();const N=f(e.default)&&!t,nt=o.useCallback(()=>{const n=e.default??null;C(n),u({value:n,source:{fromUi:!0}})},[e]);It({element:e,widgetMgr:r,onFormCleared:nt});const at=n=>{const{value:d}=n.target;if(d==="")w(!0),C(null),v(null);else{let y;e.dataType===I.DataType.INT?y=parseInt(d,10):y=parseFloat(d),w(!0),C(y),v(d)}},E=o.useCallback(()=>{V&&(w(!0),u({value:(i??b)+s,source:{fromUi:!0}}))},[i,b,s,V]),F=o.useCallback(()=>{S&&(w(!0),u({value:(i??g)-s,source:{fromUi:!0}}))},[i,g,s,S]),st=o.useCallback(n=>{const{key:d}=n;switch(d){case"ArrowUp":n.preventDefault(),E();break;case"ArrowDown":n.preventDefault(),F();break}},[E,F]),it=o.useCallback(n=>{n.key==="Enter"&&(m&&u({value:i,source:{fromUi:!0}}),r.allowFormEnterToSubmit(p)&&r.submitForm(p,l))},[m,i,u,r,p,l]);return z("div",{className:"stNumberInput","data-testid":"stNumberInput",style:{width:h},children:[c(gt,{label:e.label,disabled:t,labelVisibility:dt((j=e.labelVisibility)==null?void 0:j.value),htmlFor:L.current,children:e.help&&c(pt,{children:c(ft,{content:e.help,placement:bt.TOP_RIGHT})})}),z(Ct,{className:P?"focused":"","data-testid":"stNumberInputContainer",children:[c(wt,{type:"number",inputRef:R,value:H??"",placeholder:e.placeholder,onBlur:ot,onFocus:rt,onChange:at,onKeyPress:it,onKeyDown:st,clearable:N,clearOnEscape:N,disabled:t,"aria-label":e.label,id:L.current,overrides:{ClearIconContainer:{style:{padding:0}},ClearIcon:{props:{overrides:{Svg:{style:{color:a.colors.darkGray,padding:a.spacing.threeXS,height:a.sizes.clearIconSize,width:a.sizes.clearIconSize,":hover":{fill:a.colors.bodyText}}}}}},Input:{props:{"data-testid":"stNumberInputField",step:s,min:b,max:g,type:"number",inputMode:""},style:{lineHeight:a.lineHeights.inputWidget,paddingRight:a.spacing.sm,paddingLeft:a.spacing.sm,paddingBottom:a.spacing.sm,paddingTop:a.spacing.sm}},InputContainer:{style:()=>({borderTopRightRadius:0,borderBottomRightRadius:0})},Root:{style:{borderTopRightRadius:0,borderBottomRightRadius:0,borderLeftWidth:0,borderRightWidth:0,borderTopWidth:0,borderBottomWidth:0,paddingRight:0}}}}),h>a.breakpoints.hideNumberInputControls&&z(Tt,{children:[c(M,{"data-testid":"stNumberInputStepDown",onClick:F,disabled:!S||t,tabIndex:-1,children:c(G,{content:Q,size:"xs",color:S?"inherit":"disabled"})}),c(M,{"data-testid":"stNumberInputStepUp",onClick:E,disabled:!V||t,tabIndex:-1,children:c(G,{content:Y,size:"xs",color:V?"inherit":"disabled"})})]})]}),et&&c(vt,{clearable:N,children:c(ht,{dirty:m,value:H??"",inForm:O,allowEnterToSubmit:tt})})]})},At=lt(Rt);export{At as default};
|
@@ -1 +0,0 @@
|
|
1
|
-
import{r as y,E as _,_ as T,n as E,ay as J,z as R,j as p,bw as Q,bd as B,br as K,b9 as Y,bq as j,bD as A,d as Z,g as ee,aN as te,y as re,bE as ie,bF as ae,al as oe,R as ne,aC as se,J as P,aY as V,bn as le,bm as de,bt as ce,bG as ue,bu as fe,bv as he,F as pe}from"./index.B7J6suR-.js";import{F as ge}from"./FormClearHelper.BgwPD1tD.js";import{U as W}from"./UploadFileInfo.C-jY39rj.js";import{P as me,S as ve}from"./ProgressBar.Di2oT-20.js";var z=y.forwardRef(function(t,l){var r={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return y.createElement(_,T({iconAttrs:r,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},t,{ref:l}),y.createElement("path",{d:"M.5 1c-.28 0-.5.23-.5.5v4c0 .28.23.5.5.5h5c.28 0 .5-.22.5-.5V4l1 1h1V2H7L6 3V1.5c0-.28-.22-.5-.5-.5h-5z"}))});z.displayName="Video";var N=y.forwardRef(function(t,l){var r={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return y.createElement(_,T({iconAttrs:r,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},t,{ref:l}),y.createElement("path",{d:"M1.41 0L0 1.41l.72.72L2.5 3.94.72 5.72 0 6.41l1.41 1.44.72-.72 1.81-1.81 1.78 1.81.69.72 1.44-1.44-.72-.69-1.81-1.78 1.81-1.81.72-.72L6.41 0l-.69.72L3.94 2.5 2.13.72 1.41 0z"}))});N.displayName="X";var $=y.forwardRef(function(t,l){var r={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return y.createElement(_,T({iconAttrs:r,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:l}),y.createElement("rect",{width:24,height:24,fill:"none"}),y.createElement("path",{d:"M20 5h-3.17l-1.24-1.35A1.99 1.99 0 0014.12 3H9.88c-.56 0-1.1.24-1.48.65L7.17 5H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm-1.35 8.35l-2.79 2.79c-.32.32-.86.1-.86-.35v-1.75H9v1.75c0 .45-.54.67-.85.35l-2.79-2.79c-.2-.2-.2-.51 0-.71l2.79-2.79a.5.5 0 01.85.36v1.83h6v-1.83c0-.45.54-.67.85-.35l2.79 2.79c.2.19.2.51.01.7z"}))});$.displayName="SwitchCamera";var L;(function(t){t.XSMALL="xsmall",t.SMALL="small",t.MEDIUM="medium",t.LARGE="large"})(L||(L={}));function Se(t,l){switch(t){case"xsmall":return{padding:`${l.spacing.twoXS} ${l.spacing.sm}`,fontSize:l.fontSizes.sm};case"small":return{padding:`${l.spacing.twoXS} ${l.spacing.md}`};case"large":return{padding:`${l.spacing.md} ${l.spacing.md}`};default:return{padding:`${l.spacing.xs} ${l.spacing.md}`}}}const D=E("div",{target:"e47j7ja0"})({position:"relative",overflow:"hidden",width:"100%",objectFit:"contain"}),O=E("div",{target:"e47j7ja1"})(({theme:t,width:l})=>({backgroundColor:t.colors.secondaryBg,borderRadius:`${t.radii.default} ${t.radii.default} 0 0`,width:"100%",height:l*9/16,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"})),ye=E("p",{target:"e47j7ja2"})(({theme:t})=>({marginTop:t.spacing.sm,textAlign:"center"})),be=E("img",{target:"e47j7ja3"})(({theme:t,opacity:l})=>({borderRadius:`${t.radii.default} ${t.radii.default} 0 0`,objectFit:"contain",opacity:l})),Me=E("a",{target:"e47j7ja4"})(({theme:t})=>({color:t.colors.primary,display:"block",textDecoration:"none"})),we=E("span",{target:"e47j7ja5"})({display:"flex",alignItems:"center"}),Ue=E("div",{target:"e47j7ja6"})(({theme:t})=>({position:"absolute",top:t.spacing.lg,right:t.spacing.lg,zIndex:t.zIndices.priority,color:t.colors.fadedText40,mixBlendMode:"difference",opacity:.6})),Ce=E("div",{target:"e47j7ja8"})({height:"fit-content",width:"100%",position:"absolute",bottom:0}),Ee=E("button",{target:"e47j7ja9"})(({theme:t})=>({position:"relative",display:"inline-flex",flexDirection:"column",alignItems:"center",justifyContent:"center",backgroundColor:t.colors.lightenedBg05,border:`${t.sizes.borderWidth} solid ${t.colors.borderColor}`,borderRadius:`0 0 ${t.radii.default} ${t.radii.default}`,"&:hover":{borderColor:t.colors.primary,color:t.colors.primary},"&:active":{color:t.colors.white,borderColor:t.colors.primary,backgroundColor:t.colors.primary},"&:focus:not(:active)":{borderColor:t.colors.primary,color:t.colors.primary},"&:disabled, &:disabled:hover, &:disabled:active":{color:t.colors.fadedText40},fontWeight:t.fontWeights.normal,padding:`${t.spacing.xs} ${t.spacing.md}`,margin:t.spacing.none,lineHeight:t.lineHeights.base,color:"inherit",width:"100%",userSelect:"none","&:focus":{outline:"none"},"&:focus-visible":{boxShadow:`0 0 0 0.2rem ${J(t.colors.primary,.5)}`},...Se("medium",t)}));function H({disabled:t,onClick:l,children:r,progress:o}){return R(Ee,{disabled:t||!1,onClick:l||(()=>{}),progress:o||null,"data-testid":"stCameraInputButton",children:[r,o&&p(Ce,{children:p(me,{value:o,size:ve.EXTRASMALL,overrides:{Bar:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}},BarProgress:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}},BarContainer:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}}}})})]})}var F;(function(t){t.USER="user",t.ENVIRONMENT="environment"})(F||(F={}));const Ie=({switchFacingMode:t})=>p(Ue,{"data-testid":"stCameraInputSwitchButton",children:p(Q,{content:"Switch camera",placement:B.TOP_RIGHT,children:p(K,{kind:Y.MINIMAL,onClick:t,children:p(j,{content:$,size:"twoXL",color:A.white})})})});var G={exports:{}};(function(t,l){(function(o,a){t.exports=a(y)})(Z,function(r){return function(o){var a={};function n(s){if(a[s])return a[s].exports;var f=a[s]={i:s,l:!1,exports:{}};return o[s].call(f.exports,f,f.exports,n),f.l=!0,f.exports}return n.m=o,n.c=a,n.d=function(s,f,g){n.o(s,f)||Object.defineProperty(s,f,{enumerable:!0,get:g})},n.r=function(s){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})},n.t=function(s,f){if(f&1&&(s=n(s)),f&8||f&4&&typeof s=="object"&&s&&s.__esModule)return s;var g=Object.create(null);if(n.r(g),Object.defineProperty(g,"default",{enumerable:!0,value:s}),f&2&&typeof s!="string")for(var C in s)n.d(g,C,(function(U){return s[U]}).bind(null,C));return g},n.n=function(s){var f=s&&s.__esModule?function(){return s.default}:function(){return s};return n.d(f,"a",f),f},n.o=function(s,f){return Object.prototype.hasOwnProperty.call(s,f)},n.p="",n(n.s="./src/react-webcam.tsx")}({"./src/react-webcam.tsx":function(o,a,n){n.r(a);var s=n("react"),f=function(){var m=function(u,e){return m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,d){i.__proto__=d}||function(i,d){for(var c in d)d.hasOwnProperty(c)&&(i[c]=d[c])},m(u,e)};return function(u,e){m(u,e);function i(){this.constructor=u}u.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}(),g=function(){return g=Object.assign||function(m){for(var u,e=1,i=arguments.length;e<i;e++){u=arguments[e];for(var d in u)Object.prototype.hasOwnProperty.call(u,d)&&(m[d]=u[d])}return m},g.apply(this,arguments)},C=function(m,u){var e={};for(var i in m)Object.prototype.hasOwnProperty.call(m,i)&&u.indexOf(i)<0&&(e[i]=m[i]);if(m!=null&&typeof Object.getOwnPropertySymbols=="function")for(var d=0,i=Object.getOwnPropertySymbols(m);d<i.length;d++)u.indexOf(i[d])<0&&Object.prototype.propertyIsEnumerable.call(m,i[d])&&(e[i[d]]=m[i[d]]);return e};(function(){typeof window>"u"||(navigator.mediaDevices===void 0&&(navigator.mediaDevices={}),navigator.mediaDevices.getUserMedia===void 0&&(navigator.mediaDevices.getUserMedia=function(u){var e=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia;return e?new Promise(function(i,d){e.call(navigator,u,i,d)}):Promise.reject(new Error("getUserMedia is not implemented in this browser"))}))})();function U(){return!!(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia)}var I=function(m){f(u,m);function u(e){var i=m.call(this,e)||this;return i.canvas=null,i.ctx=null,i.requestUserMediaId=0,i.unmounted=!1,i.state={hasUserMedia:!1},i}return u.prototype.componentDidMount=function(){var e=this,i=e.state,d=e.props;if(this.unmounted=!1,!U()){d.onUserMediaError("getUserMedia not supported");return}i.hasUserMedia||this.requestUserMedia(),d.children&&typeof d.children!="function"&&console.warn("children must be a function")},u.prototype.componentDidUpdate=function(e){var i=this.props;if(!U()){i.onUserMediaError("getUserMedia not supported");return}var d=JSON.stringify(e.audioConstraints)!==JSON.stringify(i.audioConstraints),c=JSON.stringify(e.videoConstraints)!==JSON.stringify(i.videoConstraints),b=e.minScreenshotWidth!==i.minScreenshotWidth,S=e.minScreenshotHeight!==i.minScreenshotHeight;(c||b||S)&&(this.canvas=null,this.ctx=null),(d||c)&&(this.stopAndCleanup(),this.requestUserMedia())},u.prototype.componentWillUnmount=function(){this.unmounted=!0,this.stopAndCleanup()},u.stopMediaStream=function(e){e&&(e.getVideoTracks&&e.getAudioTracks?(e.getVideoTracks().map(function(i){e.removeTrack(i),i.stop()}),e.getAudioTracks().map(function(i){e.removeTrack(i),i.stop()})):e.stop())},u.prototype.stopAndCleanup=function(){var e=this.state;e.hasUserMedia&&(u.stopMediaStream(this.stream),e.src&&window.URL.revokeObjectURL(e.src))},u.prototype.getScreenshot=function(e){var i=this,d=i.state,c=i.props;if(!d.hasUserMedia)return null;var b=this.getCanvas(e);return b&&b.toDataURL(c.screenshotFormat,c.screenshotQuality)},u.prototype.getCanvas=function(e){var i=this,d=i.state,c=i.props;if(!this.video||!d.hasUserMedia||!this.video.videoHeight)return null;if(!this.ctx){var b=this.video.videoWidth,S=this.video.videoHeight;if(!this.props.forceScreenshotSourceSize){var h=b/S;b=c.minScreenshotWidth||this.video.clientWidth,S=b/h,c.minScreenshotHeight&&S<c.minScreenshotHeight&&(S=c.minScreenshotHeight,b=S*h)}this.canvas=document.createElement("canvas"),this.canvas.width=(e==null?void 0:e.width)||b,this.canvas.height=(e==null?void 0:e.height)||S,this.ctx=this.canvas.getContext("2d")}var w=this,M=w.ctx,v=w.canvas;return M&&v&&(v.width=(e==null?void 0:e.width)||v.width,v.height=(e==null?void 0:e.height)||v.height,c.mirrored&&(M.translate(v.width,0),M.scale(-1,1)),M.imageSmoothingEnabled=c.imageSmoothing,M.drawImage(this.video,0,0,(e==null?void 0:e.width)||v.width,(e==null?void 0:e.height)||v.height),c.mirrored&&(M.scale(-1,1),M.translate(-v.width,0))),v},u.prototype.requestUserMedia=function(){var e=this,i=this.props,d=function(S,h){var w={video:typeof h<"u"?h:!0};i.audio&&(w.audio=typeof S<"u"?S:!0),e.requestUserMediaId++;var M=e.requestUserMediaId;navigator.mediaDevices.getUserMedia(w).then(function(v){e.unmounted||M!==e.requestUserMediaId?u.stopMediaStream(v):e.handleUserMedia(null,v)}).catch(function(v){e.handleUserMedia(v)})};if("mediaDevices"in navigator)d(i.audioConstraints,i.videoConstraints);else{var c=function(S){return{optional:[{sourceId:S}]}},b=function(S){var h=S.deviceId;return typeof h=="string"?h:Array.isArray(h)&&h.length>0?h[0]:typeof h=="object"&&h.ideal?h.ideal:null};MediaStreamTrack.getSources(function(S){var h=null,w=null;S.forEach(function(x){x.kind==="audio"?h=x.id:x.kind==="video"&&(w=x.id)});var M=b(i.audioConstraints);M&&(h=M);var v=b(i.videoConstraints);v&&(w=v),d(c(h),c(w))})}},u.prototype.handleUserMedia=function(e,i){var d=this.props;if(e||!i){this.setState({hasUserMedia:!1}),d.onUserMediaError(e);return}this.stream=i;try{this.video&&(this.video.srcObject=i),this.setState({hasUserMedia:!0})}catch{this.setState({hasUserMedia:!0,src:window.URL.createObjectURL(i)})}d.onUserMedia(i)},u.prototype.render=function(){var e=this,i=this,d=i.state,c=i.props,b=c.audio;c.forceScreenshotSourceSize,c.onUserMedia,c.onUserMediaError,c.screenshotFormat,c.screenshotQuality,c.minScreenshotWidth,c.minScreenshotHeight,c.audioConstraints,c.videoConstraints,c.imageSmoothing;var S=c.mirrored,h=c.style,w=h===void 0?{}:h,M=c.children,v=C(c,["audio","forceScreenshotSourceSize","onUserMedia","onUserMediaError","screenshotFormat","screenshotQuality","minScreenshotWidth","minScreenshotHeight","audioConstraints","videoConstraints","imageSmoothing","mirrored","style","children"]),x=S?g(g({},w),{transform:(w.transform||"")+" scaleX(-1)"}):w,q={getScreenshot:this.getScreenshot.bind(this)};return s.createElement(s.Fragment,null,s.createElement("video",g({autoPlay:!0,src:d.src,muted:!b,playsInline:!0,ref:function(X){e.video=X},style:x},v)),M&&M(q))},u.defaultProps={audio:!1,forceScreenshotSourceSize:!1,imageSmoothing:!0,mirrored:!1,onUserMedia:function(){},onUserMediaError:function(){},screenshotFormat:"image/webp",screenshotQuality:.92},u}(s.Component);a.default=I},react:function(o,a){o.exports=r}}).default})})(G);var Fe=G.exports;const Re=ee(Fe);var k;(function(t){t.PENDING="pending",t.SUCCESS="success",t.ERROR="error"})(k||(k={}));const xe=({width:t})=>R(O,{width:t,children:[p(j,{size:"threeXL",color:A.gray60,content:z}),R(ye,{children:["This app would like to use your camera.",p(Me,{href:ae,rel:"noopener noreferrer",target:"_blank",children:"Learn how to allow access."})]})]}),Pe=({handleCapture:t,width:l,disabled:r,clearPhotoInProgress:o,setClearPhotoInProgress:a,facingMode:n,setFacingMode:s,testOverride:f})=>{const[g,C]=y.useState(f||"pending"),U=y.useRef(null),[I,m]=y.useState(l),u=y.useCallback(te(1e3,m),[]);y.useEffect(()=>{u(l)},[l,u]);function e(){if(U.current!==null){const d=U.current.getScreenshot();t(d)}}const i=re();return R(D,{"data-testid":"stCameraInputWebcamComponent",children:[g!=="success"&&!r&&!o?p(xe,{width:I}):ie&&p(Ie,{switchFacingMode:s}),p(O,{"data-testid":"stCameraInputWebcamStyledBox",hidden:g!=="success"&&!r&&!o,width:I,children:!r&&p(Re,{audio:!1,ref:U,screenshotFormat:"image/jpeg",screenshotQuality:1,width:I,height:I*9/16,style:{borderRadius:`${i.radii.default} ${i.radii.default} 0 0`},onUserMediaError:()=>{C("error")},onUserMedia:()=>{C("success"),a(!1)},videoConstraints:{width:{ideal:I},facingMode:n}})}),p(H,{onClick:e,disabled:g!=="success"||r||o,children:"Take Photo"})]})},_e=150,Te=oe.getLogger("CameraInput");class ke extends ne.PureComponent{constructor(l){super(l),this.localFileIdCounter=1,this.RESTORED_FROM_WIDGET_STRING="RESTORED_FROM_WIDGET",this.formClearHelper=new ge,this.getProgress=()=>{if(this.state.files.length>0&&this.state.files[this.state.files.length-1].status.type==="uploading")return this.state.files[this.state.files.length-1].status.progress},this.setClearPhotoInProgress=r=>{this.setState({clearPhotoInProgress:r})},this.setFacingMode=()=>{this.setState(r=>({facingMode:r.facingMode===F.USER?F.ENVIRONMENT:F.USER}))},this.handleCapture=r=>{if(r===null)return Promise.resolve();this.setState({imgSrc:r,shutter:!0,minShutterEffectPassed:!1});const o=a=>new Promise(n=>setTimeout(n,a));return je(r,`camera-input-${new Date().toISOString().replace(/:/g,"_")}.jpg`).then(a=>this.props.uploadClient.fetchFileURLs([a]).then(n=>({file:a,fileUrls:n[0]}))).then(({file:a,fileUrls:n})=>this.uploadFile(n,a)).then(()=>o(_e)).then(()=>{this.setState((a,n)=>({imgSrc:r,shutter:a.shutter,minShutterEffectPassed:!0}))}).catch(a=>{Te.error(a)})},this.removeCapture=()=>{this.state.files.length!==0&&(this.state.files.forEach(r=>this.deleteFile(r.id)),this.setState({imgSrc:null,clearPhotoInProgress:!0}))},this.componentDidUpdate=()=>{if(this.status!=="ready")return;const r=this.createWidgetValue(),{element:o,widgetMgr:a,fragmentId:n}=this.props,s=a.getFileUploaderStateValue(o);se(r,s)||a.setFileUploaderStateValue(o,r,{fromUi:!0},n)},this.onFormCleared=()=>{this.setState({files:[]},()=>{const r=this.createWidgetValue();if(P(r))return;this.setState({imgSrc:null});const{widgetMgr:o,element:a,fragmentId:n}=this.props;o.setFileUploaderStateValue(a,r,{fromUi:!0},n)})},this.deleteFile=r=>{const o=this.getFile(r);P(o)||(o.status.type==="uploading"&&o.status.cancelToken.cancel(),o.status.type==="uploaded"&&o.status.fileUrls.deleteUrl&&this.props.uploadClient.deleteFile(o.status.fileUrls.deleteUrl),this.removeFile(r))},this.addFile=r=>{this.setState(o=>({files:[...o.files,r]}))},this.removeFile=r=>{this.setState(o=>({files:o.files.filter(a=>a.id!==r)}))},this.getFile=r=>this.state.files.find(o=>o.id===r),this.updateFile=(r,o)=>{this.setState(a=>({files:a.files.map(n=>n.id===r?o:n)}))},this.onUploadComplete=(r,o)=>{this.setState(()=>({shutter:!1}));const a=this.getFile(r);P(a)||a.status.type!=="uploading"||this.updateFile(a.id,a.setStatus({type:"uploaded",fileId:o.fileId,fileUrls:o}))},this.onUploadProgress=(r,o)=>{const a=this.getFile(o);if(P(a)||a.status.type!=="uploading")return;const n=Math.round(r.loaded*100/r.total);a.status.progress!==n&&this.updateFile(o,a.setStatus({type:"uploading",cancelToken:a.status.cancelToken,progress:n}))},this.reset=()=>{this.setState({files:[],imgSrc:null})},this.uploadFile=(r,o)=>{const a=V.CancelToken.source(),n=new W(o.name,o.size,this.nextLocalFileId(),{type:"uploading",cancelToken:a,progress:1});this.addFile(n),this.props.uploadClient.uploadFile(this.props.element,r.uploadUrl,o,s=>this.onUploadProgress(s,n.id),a.token).then(()=>this.onUploadComplete(n.id,r)).catch(s=>{V.isCancel(s)||this.updateFile(n.id,n.setStatus({type:"error",errorMessage:s?s.toString():"Unknown error"}))})},this.state=this.initialValue}get initialValue(){const l={files:[],imgSrc:null,shutter:!1,minShutterEffectPassed:!0,clearPhotoInProgress:!1,facingMode:F.USER},{widgetMgr:r,element:o}=this.props,a=r.getFileUploaderStateValue(o);if(P(a))return l;const{uploadedFileInfo:n}=a;return P(n)||n.length===0?l:{files:n.map(s=>{const f=s.name,g=s.size,C=s.fileId,U=s.fileUrls;return new W(f,g,this.nextLocalFileId(),{type:"uploaded",fileId:C,fileUrls:U})}),imgSrc:n.length===0?"":this.RESTORED_FROM_WIDGET_STRING,shutter:!1,minShutterEffectPassed:!1,clearPhotoInProgress:!1,facingMode:F.USER}}componentWillUnmount(){this.formClearHelper.disconnect()}get status(){const l=r=>r.status.type==="uploading";return this.state.files.some(l)?"updating":"ready"}componentDidMount(){const l=this.createWidgetValue(),{element:r,widgetMgr:o,fragmentId:a}=this.props;o.getFileUploaderStateValue(r)===void 0&&o.setFileUploaderStateValue(r,l,{fromUi:!1},a)}createWidgetValue(){const l=this.state.files.filter(r=>r.status.type==="uploaded").map(r=>{const{name:o,size:a,status:n}=r;return new le({fileId:n.fileId,fileUrls:n.fileUrls,name:o,size:a})});return new de({uploadedFileInfo:l})}render(){var n;const{element:l,widgetMgr:r,disabled:o,width:a}=this.props;return this.formClearHelper.manageFormClearListener(r,l.formId,this.onFormCleared),R(D,{className:"stCameraInput","data-testid":"stCameraInput",children:[p(he,{label:l.label,disabled:o,labelVisibility:ce((n=l.labelVisibility)==null?void 0:n.value),children:l.help&&p(ue,{children:p(fe,{content:l.help,placement:B.TOP_RIGHT})})}),this.state.imgSrc?R(pe,{children:[p(O,{width:a,children:this.state.imgSrc!==this.RESTORED_FROM_WIDGET_STRING&&p(be,{src:this.state.imgSrc,alt:"Snapshot",opacity:this.state.shutter||!this.state.minShutterEffectPassed?"50%":"100%",width:a,height:a*9/16})}),p(H,{onClick:this.removeCapture,progress:this.getProgress(),disabled:!!this.getProgress()||o,children:this.getProgress()?"Uploading...":R(we,{children:[p(j,{content:N,margin:"0 xs 0 0",size:"sm"})," Clear photo"]})})]}):p(Pe,{handleCapture:this.handleCapture,width:a,disabled:o,clearPhotoInProgress:this.state.clearPhotoInProgress,setClearPhotoInProgress:this.setClearPhotoInProgress,facingMode:this.state.facingMode,setFacingMode:this.setFacingMode,testOverride:this.props.testOverride})]})}nextLocalFileId(){return this.localFileIdCounter++}}function je(t,l){return fetch(t).then(r=>r.arrayBuffer()).then(r=>new File([r],l,{type:"image/jpeg"}))}export{ke as default};
|
@@ -1 +0,0 @@
|
|
1
|
-
import{r as i,J as h}from"./index.B7J6suR-.js";import{u as p}from"./FormClearHelper.BgwPD1tD.js";function v({getStateFromWidgetMgr:e,getDefaultState:c,updateWidgetMgrState:l,element:s,widgetMgr:u,fragmentId:t,onFormCleared:r}){const[n,V]=i.useState(()=>e(u,s)??c(u,s)),[f,a]=i.useState({value:n,fromUi:!1});i.useEffect(()=>{h(f)||(a(null),V(f.value),l(s,u,f,t))},[f,l,s,u,t]);const o=i.useCallback(()=>{a({value:c(u,s),fromUi:!0}),r==null||r()},[a,s,c,u,r]);return p({widgetMgr:u,element:s,onFormCleared:o}),[n,a]}function E({getStateFromWidgetMgr:e,getDefaultStateFromProto:c,getCurrStateFromProto:l,updateWidgetMgrState:s,element:u,widgetMgr:t,fragmentId:r,onFormCleared:n}){const V=i.useCallback((o,x)=>c(x),[c]),[f,a]=v({getStateFromWidgetMgr:e,getDefaultState:V,updateWidgetMgrState:s,element:u,widgetMgr:t,fragmentId:r,onFormCleared:n});return i.useEffect(()=>{u.setValue&&(u.setValue=!1,a({value:l(u),fromUi:!1}))},[u,l,a]),[f,a]}export{E as a,v as u};
|
Binary file
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|