streamlit 1.51.0__py3-none-any.whl → 1.52.0__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/__init__.py +1 -0
- streamlit/commands/execution_control.py +89 -14
- streamlit/components/v1/component_arrow.py +7 -7
- streamlit/components/v2/__init__.py +59 -3
- streamlit/components/v2/bidi_component/main.py +161 -13
- streamlit/components/v2/bidi_component/serialization.py +13 -6
- streamlit/components/v2/component_manager.py +11 -3
- streamlit/components/v2/component_registry.py +18 -1
- streamlit/components/v2/types.py +2 -2
- streamlit/connections/snowflake_connection.py +1 -1
- streamlit/connections/snowpark_connection.py +1 -1
- streamlit/dataframe_util.py +18 -18
- streamlit/delta_generator.py +7 -0
- streamlit/delta_generator_singletons.py +8 -14
- streamlit/elements/alert.py +16 -0
- streamlit/elements/arrow.py +36 -6
- streamlit/elements/bokeh_chart.py +10 -78
- streamlit/elements/code.py +2 -2
- streamlit/elements/deck_gl_json_chart.py +1 -1
- streamlit/elements/exception.py +1 -1
- streamlit/elements/form.py +27 -0
- streamlit/elements/heading.py +60 -5
- streamlit/elements/html.py +13 -2
- streamlit/elements/image.py +1 -1
- streamlit/elements/layouts.py +28 -22
- streamlit/elements/lib/built_in_chart_utils.py +49 -16
- streamlit/elements/lib/color_util.py +1 -1
- streamlit/elements/lib/column_config_utils.py +6 -5
- streamlit/elements/lib/layout_utils.py +50 -0
- streamlit/elements/lib/pandas_styler_utils.py +17 -9
- streamlit/elements/lib/shortcut_utils.py +152 -0
- streamlit/elements/markdown.py +50 -3
- streamlit/elements/metric.py +31 -1
- streamlit/elements/plotly_chart.py +75 -6
- streamlit/elements/spinner.py +1 -1
- streamlit/elements/text.py +20 -3
- streamlit/elements/toast.py +2 -0
- streamlit/elements/vega_charts.py +17 -1
- streamlit/elements/widgets/audio_input.py +8 -7
- streamlit/elements/widgets/button.py +279 -40
- streamlit/elements/widgets/button_group.py +27 -2
- streamlit/elements/widgets/camera_input.py +1 -1
- streamlit/elements/widgets/chat.py +300 -42
- streamlit/elements/widgets/color_picker.py +7 -0
- streamlit/elements/widgets/data_editor.py +68 -28
- streamlit/elements/widgets/file_uploader.py +4 -1
- streamlit/elements/widgets/number_input.py +2 -0
- streamlit/elements/widgets/text_widgets.py +2 -0
- streamlit/elements/widgets/time_widgets.py +581 -9
- streamlit/errors.py +22 -0
- streamlit/git_util.py +1 -1
- streamlit/navigation/page.py +7 -0
- streamlit/net_util.py +2 -2
- streamlit/proto/Alert_pb2.pyi +3 -3
- streamlit/proto/AppPage_pb2.pyi +7 -1
- streamlit/proto/ArrowData_pb2.pyi +7 -1
- streamlit/proto/ArrowNamedDataSet_pb2.pyi +7 -1
- streamlit/proto/ArrowVegaLiteChart_pb2.pyi +7 -1
- streamlit/proto/Arrow_pb2.py +10 -10
- streamlit/proto/Arrow_pb2.pyi +19 -12
- streamlit/proto/AudioInput_pb2.pyi +7 -1
- streamlit/proto/Audio_pb2.pyi +7 -1
- streamlit/proto/AuthRedirect_pb2.pyi +7 -1
- streamlit/proto/AutoRerun_pb2.pyi +7 -1
- streamlit/proto/BackMsg_pb2.py +4 -2
- streamlit/proto/BackMsg_pb2.pyi +34 -4
- streamlit/proto/Balloons_pb2.pyi +7 -1
- streamlit/proto/BidiComponent_pb2.pyi +10 -4
- streamlit/proto/Block_pb2.pyi +35 -35
- streamlit/proto/BokehChart_pb2.pyi +7 -1
- streamlit/proto/ButtonGroup_pb2.pyi +9 -9
- streamlit/proto/Button_pb2.py +2 -2
- streamlit/proto/Button_pb2.pyi +11 -2
- streamlit/proto/CameraInput_pb2.pyi +7 -1
- streamlit/proto/ChatInput_pb2.py +6 -6
- streamlit/proto/ChatInput_pb2.pyi +18 -6
- streamlit/proto/Checkbox_pb2.pyi +3 -3
- streamlit/proto/ClientState_pb2.pyi +10 -4
- streamlit/proto/Code_pb2.pyi +7 -1
- streamlit/proto/ColorPicker_pb2.pyi +7 -1
- streamlit/proto/Common_pb2.py +3 -3
- streamlit/proto/Common_pb2.pyi +35 -23
- streamlit/proto/Components_pb2.pyi +19 -13
- streamlit/proto/DataFrame_pb2.pyi +55 -49
- streamlit/proto/DateInput_pb2.pyi +7 -1
- streamlit/proto/DateTimeInput_pb2.py +28 -0
- streamlit/proto/DateTimeInput_pb2.pyi +92 -0
- streamlit/proto/DeckGlJsonChart_pb2.pyi +3 -3
- streamlit/proto/Delta_pb2.pyi +7 -1
- streamlit/proto/DocString_pb2.pyi +10 -4
- streamlit/proto/DownloadButton_pb2.py +2 -2
- streamlit/proto/DownloadButton_pb2.pyi +16 -2
- streamlit/proto/Element_pb2.py +5 -3
- streamlit/proto/Element_pb2.pyi +23 -5
- streamlit/proto/Empty_pb2.pyi +7 -1
- streamlit/proto/Exception_pb2.pyi +7 -1
- streamlit/proto/Favicon_pb2.pyi +7 -1
- streamlit/proto/FileUploader_pb2.pyi +7 -1
- streamlit/proto/ForwardMsg_pb2.py +12 -10
- streamlit/proto/ForwardMsg_pb2.pyi +42 -15
- streamlit/proto/GapSize_pb2.pyi +4 -4
- streamlit/proto/GitInfo_pb2.pyi +3 -3
- streamlit/proto/GraphVizChart_pb2.pyi +7 -1
- streamlit/proto/Heading_pb2.pyi +7 -1
- streamlit/proto/HeightConfig_pb2.pyi +7 -1
- streamlit/proto/Html_pb2.py +2 -2
- streamlit/proto/Html_pb2.pyi +11 -2
- streamlit/proto/IFrame_pb2.pyi +7 -1
- streamlit/proto/Image_pb2.pyi +10 -4
- streamlit/proto/Json_pb2.pyi +7 -1
- streamlit/proto/LabelVisibilityMessage_pb2.pyi +3 -3
- streamlit/proto/LinkButton_pb2.py +2 -2
- streamlit/proto/LinkButton_pb2.pyi +15 -2
- streamlit/proto/Logo_pb2.pyi +7 -1
- streamlit/proto/Markdown_pb2.pyi +3 -3
- streamlit/proto/Metric_pb2.pyi +7 -7
- streamlit/proto/MetricsEvent_pb2.pyi +10 -4
- streamlit/proto/MultiSelect_pb2.pyi +7 -1
- streamlit/proto/NamedDataSet_pb2.pyi +7 -1
- streamlit/proto/Navigation_pb2.pyi +3 -3
- streamlit/proto/NewSession_pb2.pyi +40 -40
- streamlit/proto/NumberInput_pb2.pyi +3 -3
- streamlit/proto/PageConfig_pb2.pyi +7 -7
- streamlit/proto/PageInfo_pb2.pyi +7 -1
- streamlit/proto/PageLink_pb2.py +2 -2
- streamlit/proto/PageLink_pb2.pyi +11 -2
- streamlit/proto/PageNotFound_pb2.pyi +7 -1
- streamlit/proto/PageProfile_pb2.pyi +13 -7
- streamlit/proto/PagesChanged_pb2.pyi +7 -1
- streamlit/proto/ParentMessage_pb2.pyi +7 -1
- streamlit/proto/PlotlyChart_pb2.pyi +6 -6
- streamlit/proto/Progress_pb2.pyi +7 -1
- streamlit/proto/Radio_pb2.pyi +7 -1
- streamlit/proto/RootContainer_pb2.pyi +1 -1
- streamlit/proto/Selectbox_pb2.pyi +7 -1
- streamlit/proto/SessionEvent_pb2.pyi +7 -1
- streamlit/proto/SessionStatus_pb2.pyi +7 -1
- streamlit/proto/Skeleton_pb2.pyi +3 -3
- streamlit/proto/Slider_pb2.pyi +5 -5
- streamlit/proto/Snow_pb2.pyi +7 -1
- streamlit/proto/Space_pb2.pyi +7 -1
- streamlit/proto/Spinner_pb2.pyi +7 -1
- streamlit/proto/TextAlignmentConfig_pb2.py +29 -0
- streamlit/proto/TextAlignmentConfig_pb2.pyi +68 -0
- streamlit/proto/TextArea_pb2.pyi +7 -1
- streamlit/proto/TextInput_pb2.pyi +3 -3
- streamlit/proto/Text_pb2.pyi +7 -1
- streamlit/proto/TimeInput_pb2.pyi +7 -1
- streamlit/proto/Toast_pb2.pyi +7 -1
- streamlit/proto/VegaLiteChart_pb2.pyi +7 -1
- streamlit/proto/Video_pb2.pyi +6 -6
- streamlit/proto/WidgetStates_pb2.pyi +10 -4
- streamlit/proto/WidthConfig_pb2.pyi +7 -1
- streamlit/proto/openmetrics_data_model_pb2.pyi +52 -52
- streamlit/runtime/app_session.py +38 -1
- streamlit/runtime/caching/cache_data_api.py +1 -1
- streamlit/runtime/caching/cache_resource_api.py +2 -2
- streamlit/runtime/caching/cache_utils.py +1 -1
- streamlit/runtime/caching/hashing.py +1 -1
- streamlit/runtime/download_data_util.py +53 -0
- streamlit/runtime/forward_msg_queue.py +1 -0
- streamlit/runtime/media_file_manager.py +178 -2
- streamlit/runtime/metrics_util.py +87 -3
- streamlit/runtime/scriptrunner/script_runner.py +3 -1
- streamlit/runtime/state/query_params.py +80 -29
- streamlit/runtime/state/session_state.py +2 -2
- streamlit/static/index.html +1 -1
- streamlit/static/manifest.json +530 -229
- streamlit/static/static/js/{ErrorOutline.esm.YoJdlW1p.js → ErrorOutline.esm.ZJDbmVTx.js} +1 -1
- streamlit/static/static/js/{FileDownload.esm.Ddx8VEYy.js → FileDownload.esm.Dx0vI3vH.js} +1 -1
- streamlit/static/static/js/{FileHelper.90EtOmj9.js → FileHelper.B7Ero7qQ.js} +3 -3
- streamlit/static/static/js/{FormClearHelper.BB1Km6eP.js → FormClearHelper.CG2XN1_g.js} +1 -1
- streamlit/static/static/js/IFrameUtil.DefezniK.js +1 -0
- streamlit/static/static/js/InputInstructions.Cj5-1zf6.js +1 -0
- streamlit/static/static/js/Particles.BfWfv0Aw.js +1 -0
- streamlit/static/static/js/{ProgressBar.DLY8H6nE.js → ProgressBar.CGQ8OgfO.js} +2 -2
- streamlit/static/static/js/StreamlitSyntaxHighlighter.DTKLpwhl.js +20 -0
- streamlit/static/static/js/{Toolbar.D8nHCkuz.js → Toolbar.B2qFUmd9.js} +1 -1
- streamlit/static/static/js/_arrayIncludes.B19Iyn2B.js +1 -0
- streamlit/static/static/js/_baseIndexOf.BTknn6Gb.js +1 -0
- streamlit/static/static/js/{base-input.CJGiNqed.js → base-input.o9tL8MDP.js} +4 -4
- streamlit/static/static/js/{checkbox.Cpdd482O.js → checkbox.0BeV1IBL.js} +1 -1
- streamlit/static/static/js/{createSuper.CuQIogbW.js → createSuper.RBO59fEm.js} +1 -1
- streamlit/static/static/js/data-grid-overlay-editor.CiTkUy0t.js +1 -0
- streamlit/static/static/js/{downloader.CN0K7xlu.js → downloader.DwNZg3Mw.js} +1 -1
- streamlit/static/static/js/embed.XT9xNd3F.js +195 -0
- streamlit/static/static/js/{es6.BJcsVXQ0.js → es6.x9KsYQg-.js} +2 -2
- streamlit/static/static/js/{iframeResizer.contentWindow.XzUvQqcZ.js → iframeResizer.contentWindow.ZVXpMPi0.js} +1 -1
- streamlit/static/static/js/index.5VPOamri.js +1 -0
- streamlit/static/static/js/index.8HslT92O.js +14 -0
- streamlit/static/static/js/index.AnXMIBz3.js +7 -0
- streamlit/static/static/js/index.B0yp3bM1.js +6 -0
- streamlit/static/static/js/index.B1fRb5wF.js +1 -0
- streamlit/static/static/js/index.B527JZdO.js +3 -0
- streamlit/static/static/js/index.BHgV-yW4.js +1 -0
- streamlit/static/static/js/index.BQr-XwGV.js +1 -0
- streamlit/static/static/js/index.BTtmaLDB.js +1 -0
- streamlit/static/static/js/index.BWB_91TA.js +1 -0
- streamlit/static/static/js/index.BfEKaEmw.js +1 -0
- streamlit/static/static/js/index.BfXjTO8b.js +1 -0
- streamlit/static/static/js/index.Bjy4NRu9.js +3 -0
- streamlit/static/static/js/index.Bu5JWpT_.js +1 -0
- streamlit/static/static/js/index.BuCx76ZV.js +1 -0
- streamlit/static/static/js/index.BxjzhVUb.js +2 -0
- streamlit/static/static/js/index.By55VdPY.js +1 -0
- streamlit/static/static/js/index.CF5MxTbK.js +1 -0
- streamlit/static/static/js/index.CLmq_z9K.js +1 -0
- streamlit/static/static/js/index.CNH4rdSz.js +1 -0
- streamlit/static/static/js/{index.D3GPA5k4.js → index.CTgm_-jO.js} +9 -40
- streamlit/static/static/js/index.C_rK-Swb.js +188 -0
- streamlit/static/static/js/index.CjozwSzS.js +1 -0
- streamlit/static/static/js/{index.DOFlg3dS.js → index.CkGVt6-G.js} +1 -1
- streamlit/static/static/js/index.CuvXOyER.js +2 -0
- streamlit/static/static/js/{index.B_dWA3vd.js → index.CyUHWoCC.js} +2 -2
- streamlit/static/static/js/index.CyroQtI4.js +2 -0
- streamlit/static/static/js/index.D6HmkoDm.js +263 -0
- streamlit/static/static/js/index.DAqCNvsO.js +1 -0
- streamlit/static/static/js/index.DB_w_CZQ.js +1 -0
- streamlit/static/static/js/index.DBalctjj.js +2 -0
- streamlit/static/static/js/index.DK0RFJUG.js +11 -0
- streamlit/static/static/js/index.DMxc2XFp.js +151 -0
- streamlit/static/static/js/index.DO5utP74.js +2 -0
- streamlit/static/static/js/index.DS7lf09n.js +1 -0
- streamlit/static/static/js/index.DWexTVLY.js +1 -0
- streamlit/static/static/js/index.DXxnU5ej.js +1 -0
- streamlit/static/static/js/index.DcU3uDvB.js +2 -0
- streamlit/static/static/js/index.DlltaH7J.js +1 -0
- streamlit/static/static/js/index.DpNTZz82.js +27 -0
- streamlit/static/static/js/index.Dr9HIhQw.js +1 -0
- streamlit/static/static/js/index.DsgAU5lc.js +1 -0
- streamlit/static/static/js/{index.DPUXkcQL.js → index.KfXqjDYy.js} +1 -1
- streamlit/static/static/js/index.PaidgjCs.js +1 -0
- streamlit/static/static/js/index.RJZuWCGA.js +1 -0
- streamlit/static/static/js/{index.CxIUUfab.js → index.hbeqcRTn.js} +53 -122
- streamlit/static/static/js/index.q5hIQwAY.js +1 -0
- streamlit/static/static/js/index.rORSX6IW.js +1 -0
- streamlit/static/static/js/index.uSX757_v.js +1 -0
- streamlit/static/static/js/index.x_QRaLMd.js +1 -0
- streamlit/static/static/js/{input.D4MN_FzN.js → input.D5oh9-aB.js} +2 -2
- streamlit/static/static/js/main.q9oGOg0H.js +13 -0
- streamlit/static/static/js/{memory.DrZjtdGT.js → memory.5kCSFUJS.js} +1 -1
- streamlit/static/static/js/moment.C3j7ZXd7.js +4 -0
- streamlit/static/static/js/number-overlay-editor.Cn_LsK8N.js +9 -0
- streamlit/static/static/js/pandasStylerUtils.BqhXt51_.js +1 -0
- streamlit/static/static/js/{possibleConstructorReturn.exeeJQEP.js → possibleConstructorReturn.DD9NK1Z8.js} +1 -1
- streamlit/static/static/js/{sandbox.ClO3IuUr.js → sandbox.DACSyz29.js} +1 -1
- streamlit/static/static/js/styled-components.C3R090At.js +1 -0
- streamlit/static/static/js/threshold.Q1mXg5rX.js +1 -0
- streamlit/static/static/js/throttle.B0GR3Iyz.js +1 -0
- streamlit/static/static/js/{timepicker.DAhu-vcF.js → timepicker.BdhzPxrv.js} +1 -1
- streamlit/static/static/js/timer.C2hYhUse.js +1 -0
- streamlit/static/static/js/{toConsumableArray.DNbljYEC.js → toConsumableArray.Db2pdqM2.js} +1 -1
- streamlit/static/static/js/uniqueId.CtqIr-Yh.js +1 -0
- streamlit/static/static/js/urls.BwSlolu9.js +1 -0
- streamlit/static/static/js/{useBasicWidgetState.D6sOH6oI.js → useBasicWidgetState.Bfp6TnSw.js} +1 -1
- streamlit/static/static/js/useIntlLocale.hRV75Xgj.js +12 -0
- streamlit/static/static/js/{useTextInputAutoExpand.4u3_GcuN.js → useTextInputAutoExpand.QepX7n8Y.js} +1 -1
- streamlit/static/static/js/useUpdateUiValue.DHx8TzX6.js +1 -0
- streamlit/static/static/js/useWaveformController.WxVzpzEX.js +1 -0
- streamlit/static/static/js/value.B4vHRSi7.js +1 -0
- streamlit/static/static/js/withCalculatedWidth.DcKeRSWJ.js +1 -0
- streamlit/static/static/js/withFullScreenWrapper.CrHddARq.js +1 -0
- streamlit/string_util.py +8 -1
- streamlit/testing/v1/app_test.py +15 -0
- streamlit/testing/v1/element_tree.py +62 -0
- streamlit/web/bootstrap.py +24 -0
- streamlit/web/server/oauth_authlib_routes.py +5 -2
- streamlit/web/server/upload_file_request_handler.py +16 -0
- {streamlit-1.51.0.dist-info → streamlit-1.52.0.dist-info}/METADATA +9 -5
- {streamlit-1.51.0.dist-info → streamlit-1.52.0.dist-info}/RECORD +274 -239
- streamlit/static/static/js/InputInstructions.jhH15PqV.js +0 -1
- streamlit/static/static/js/Particles.DUsputn1.js +0 -1
- streamlit/static/static/js/data-grid-overlay-editor.2Ufgxc6y.js +0 -1
- streamlit/static/static/js/index.B1ZQh4P1.js +0 -1
- streamlit/static/static/js/index.BKstZk0M.js +0 -27
- streamlit/static/static/js/index.BMcFsUee.js +0 -1
- streamlit/static/static/js/index.BR-IdcTb.js +0 -2
- streamlit/static/static/js/index.BgnZEMVh.js +0 -1
- streamlit/static/static/js/index.BohqXifI.js +0 -1
- streamlit/static/static/js/index.Br5nxKNj.js +0 -2
- streamlit/static/static/js/index.BrIKVbNc.js +0 -3
- streamlit/static/static/js/index.BtWUPzle.js +0 -1
- streamlit/static/static/js/index.C0RLraek.js +0 -1
- streamlit/static/static/js/index.CAIjskgG.js +0 -1
- streamlit/static/static/js/index.CAj-7vWz.js +0 -949
- streamlit/static/static/js/index.CMtEit2O.js +0 -1
- streamlit/static/static/js/index.CkRlykEE.js +0 -12
- streamlit/static/static/js/index.CmN3FXfI.js +0 -1617
- streamlit/static/static/js/index.CwbFI1_-.js +0 -1
- streamlit/static/static/js/index.D2KPNy7e.js +0 -1
- streamlit/static/static/js/index.DGAh7DMq.js +0 -1
- streamlit/static/static/js/index.DKb_NvmG.js +0 -197
- streamlit/static/static/js/index.DMqgUYKq.js +0 -1
- streamlit/static/static/js/index.DX1xY89g.js +0 -1
- streamlit/static/static/js/index.DYATBCsq.js +0 -2
- streamlit/static/static/js/index.DaSmGJ76.js +0 -3
- streamlit/static/static/js/index.Dd7bMeLP.js +0 -1
- streamlit/static/static/js/index.DjmmgI5U.js +0 -1
- streamlit/static/static/js/index.Dq56CyM2.js +0 -1
- streamlit/static/static/js/index.DuiXaS5_.js +0 -7
- streamlit/static/static/js/index.DvFidMLe.js +0 -2
- streamlit/static/static/js/index.DwkhC5Pc.js +0 -1
- streamlit/static/static/js/index.Q-3sFn1v.js +0 -1
- streamlit/static/static/js/index.QJ5QO9sJ.js +0 -1
- streamlit/static/static/js/index.VwTaeety.js +0 -1
- streamlit/static/static/js/index.YOqQbeX8.js +0 -1
- streamlit/static/static/js/number-overlay-editor.DRwAw1In.js +0 -9
- streamlit/static/static/js/uniqueId.oG4Gvj1v.js +0 -1
- streamlit/static/static/js/useUpdateUiValue.F2R3eTeR.js +0 -1
- streamlit/static/static/js/withFullScreenWrapper.zothJIsI.js +0 -1
- {streamlit-1.51.0.data → streamlit-1.52.0.data}/scripts/streamlit.cmd +0 -0
- {streamlit-1.51.0.dist-info → streamlit-1.52.0.dist-info}/WHEEL +0 -0
- {streamlit-1.51.0.dist-info → streamlit-1.52.0.dist-info}/entry_points.txt +0 -0
- {streamlit-1.51.0.dist-info → streamlit-1.52.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as y,E as O,_ as T,x as I,t as X,l as x,j as h,ay as Q,P as j,b as J,B as K,ax as W,bK as B,al as Y,ag as Z,bm as ee,g as te,bL as re,Q as ie,bn as oe,e as P,bM as ne,bN as ae,m as se,ab as le,T as de,ac as ce,a0 as ue}from"./index.DMxc2XFp.js";import{w as fe}from"./withCalculatedWidth.DcKeRSWJ.js";import{U as z}from"./UploadFileInfo.C-jY39rj.js";import{F as pe}from"./FormClearHelper.CG2XN1_g.js";import{P as he,S as ge}from"./ProgressBar.CGQ8OgfO.js";import{b as me}from"./urls.BwSlolu9.js";var k=y.forwardRef(function(i,l){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return y.createElement(O,T({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},i,{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"}))});k.displayName="SwitchCamera";var $=y.forwardRef(function(i,l){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return y.createElement(O,T({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},i,{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"}))});$.displayName="Video";var A=y.forwardRef(function(i,l){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return y.createElement(O,T({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},i,{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"}))});A.displayName="X";function ve(i,l){switch(i){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 N=I("div",{target:"etzmx8d0"})({position:"relative",overflow:"hidden",width:"100%",objectFit:"contain"}),V=I("div",{target:"etzmx8d1"})(({theme:i,width:l})=>({backgroundColor:i.colors.secondaryBg,borderRadius:`${i.radii.default} ${i.radii.default} 0 0`,width:"100%",height:l*9/16,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"})),Se=I("p",{target:"etzmx8d2"})(({theme:i})=>({marginTop:i.spacing.sm,textAlign:"center"})),ye=I("img",{target:"etzmx8d3"})(({theme:i,opacity:l})=>({borderRadius:`${i.radii.default} ${i.radii.default} 0 0`,objectFit:"contain",opacity:l})),be=I("a",{target:"etzmx8d4"})(({theme:i})=>({color:i.colors.link,textDecoration:i.linkUnderline?"underline":"none",display:"block"})),we=I("span",{target:"etzmx8d5"})({display:"flex",alignItems:"center"}),Ce=I("div",{target:"etzmx8d6"})(({theme:i})=>({position:"absolute",top:i.spacing.lg,right:i.spacing.lg,zIndex:i.zIndices.priority,color:i.colors.fadedText40,mixBlendMode:"difference",opacity:.6})),Me=I("div",{target:"etzmx8d8"})({height:"fit-content",width:"100%",position:"absolute",bottom:0}),Ue=I("button",{target:"etzmx8d9"})(({theme:i})=>({position:"relative",display:"inline-flex",flexDirection:"column",alignItems:"center",justifyContent:"center",backgroundColor:i.colors.lightenedBg05,border:`${i.sizes.borderWidth} solid ${i.colors.borderColor}`,borderRadius:`0 0 ${i.radii.default} ${i.radii.default}`,"&:hover":{borderColor:i.colors.primary,color:i.colors.primary},"&:active":{color:i.colors.white,borderColor:i.colors.primary,backgroundColor:i.colors.primary},"&:focus:not(:active)":{borderColor:i.colors.primary,color:i.colors.primary},"&:disabled, &:disabled:hover, &:disabled:active":{color:i.colors.fadedText40,borderColor:i.colors.borderColor,backgroundColor:i.colors.lightenedBg05,cursor:"not-allowed"},fontWeight:i.fontWeights.normal,padding:`${i.spacing.xs} ${i.spacing.md}`,margin:i.spacing.none,lineHeight:i.lineHeights.base,color:"inherit",width:"100%",userSelect:"none","&:focus":{outline:"none"},"&:focus-visible":{boxShadow:`0 0 0 0.2rem ${X(i.colors.primary,.5)}`},...ve("medium",i)}));function Ie({disabled:i,onClick:l,children:t,progress:n}){return x(Ue,{disabled:i||!1,onClick:l||(()=>{}),progress:n||null,"data-testid":"stCameraInputButton",children:[t,n?h(Me,{children:h(he,{value:n,size:ge.EXTRASMALL,overrides:{Bar:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}},BarProgress:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}},BarContainer:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}}}})}):null]})}const H=y.memo(Ie);var R=function(i){return i.USER="user",i.ENVIRONMENT="environment",i}({});const Ee=({switchFacingMode:i})=>h(Ce,{"data-testid":"stCameraInputSwitchButton",children:h(Q,{content:"Switch camera",placement:j.TOP_RIGHT,children:h(J,{kind:K.MINIMAL,onClick:i,children:h(W,{content:k,size:"twoXL",color:B.white})})})}),xe=y.memo(Ee);var _={exports:{}},Fe=_.exports,L;function Pe(){return L||(L=1,function(i,l){(function(n,o){i.exports=o(Y())})(Fe,function(t){return function(n){var o={};function a(s){if(o[s])return o[s].exports;var f=o[s]={i:s,l:!1,exports:{}};return n[s].call(f.exports,f,f.exports,a),f.l=!0,f.exports}return a.m=n,a.c=o,a.d=function(s,f,g){a.o(s,f)||Object.defineProperty(s,f,{enumerable:!0,get:g})},a.r=function(s){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})},a.t=function(s,f){if(f&1&&(s=a(s)),f&8||f&4&&typeof s=="object"&&s&&s.__esModule)return s;var g=Object.create(null);if(a.r(g),Object.defineProperty(g,"default",{enumerable:!0,value:s}),f&2&&typeof s!="string")for(var U in s)a.d(g,U,(function(M){return s[M]}).bind(null,U));return g},a.n=function(s){var f=s&&s.__esModule?function(){return s.default}:function(){return s};return a.d(f,"a",f),f},a.o=function(s,f){return Object.prototype.hasOwnProperty.call(s,f)},a.p="",a(a.s="./src/react-webcam.tsx")}({"./src/react-webcam.tsx":function(n,o,a){a.r(o);var s=a("react"),f=function(){var m=function(u,e){return m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,d){r.__proto__=d}||function(r,d){for(var c in d)d.hasOwnProperty(c)&&(r[c]=d[c])},m(u,e)};return function(u,e){m(u,e);function r(){this.constructor=u}u.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}}(),g=function(){return g=Object.assign||function(m){for(var u,e=1,r=arguments.length;e<r;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)},U=function(m,u){var e={};for(var r in m)Object.prototype.hasOwnProperty.call(m,r)&&u.indexOf(r)<0&&(e[r]=m[r]);if(m!=null&&typeof Object.getOwnPropertySymbols=="function")for(var d=0,r=Object.getOwnPropertySymbols(m);d<r.length;d++)u.indexOf(r[d])<0&&Object.prototype.propertyIsEnumerable.call(m,r[d])&&(e[r[d]]=m[r[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(r,d){e.call(navigator,u,r,d)}):Promise.reject(new Error("getUserMedia is not implemented in this browser"))}))})();function M(){return!!(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia)}var E=function(m){f(u,m);function u(e){var r=m.call(this,e)||this;return r.canvas=null,r.ctx=null,r.requestUserMediaId=0,r.unmounted=!1,r.state={hasUserMedia:!1},r}return u.prototype.componentDidMount=function(){var e=this,r=e.state,d=e.props;if(this.unmounted=!1,!M()){d.onUserMediaError("getUserMedia not supported");return}r.hasUserMedia||this.requestUserMedia(),d.children&&typeof d.children!="function"&&console.warn("children must be a function")},u.prototype.componentDidUpdate=function(e){var r=this.props;if(!M()){r.onUserMediaError("getUserMedia not supported");return}var d=JSON.stringify(e.audioConstraints)!==JSON.stringify(r.audioConstraints),c=JSON.stringify(e.videoConstraints)!==JSON.stringify(r.videoConstraints),w=e.minScreenshotWidth!==r.minScreenshotWidth,S=e.minScreenshotHeight!==r.minScreenshotHeight;(c||w||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(r){e.removeTrack(r),r.stop()}),e.getAudioTracks().map(function(r){e.removeTrack(r),r.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 r=this,d=r.state,c=r.props;if(!d.hasUserMedia)return null;var w=this.getCanvas(e);return w&&w.toDataURL(c.screenshotFormat,c.screenshotQuality)},u.prototype.getCanvas=function(e){var r=this,d=r.state,c=r.props;if(!this.video||!d.hasUserMedia||!this.video.videoHeight)return null;if(!this.ctx){var w=this.video.videoWidth,S=this.video.videoHeight;if(!this.props.forceScreenshotSourceSize){var v=w/S;w=c.minScreenshotWidth||this.video.clientWidth,S=w/v,c.minScreenshotHeight&&S<c.minScreenshotHeight&&(S=c.minScreenshotHeight,w=S*v)}this.canvas=document.createElement("canvas"),this.canvas.width=e?.width||w,this.canvas.height=e?.height||S,this.ctx=this.canvas.getContext("2d")}var C=this,b=C.ctx,p=C.canvas;return b&&p&&(p.width=e?.width||p.width,p.height=e?.height||p.height,c.mirrored&&(b.translate(p.width,0),b.scale(-1,1)),b.imageSmoothingEnabled=c.imageSmoothing,b.drawImage(this.video,0,0,e?.width||p.width,e?.height||p.height),c.mirrored&&(b.scale(-1,1),b.translate(-p.width,0))),p},u.prototype.requestUserMedia=function(){var e=this,r=this.props,d=function(S,v){var C={video:typeof v<"u"?v:!0};r.audio&&(C.audio=typeof S<"u"?S:!0),e.requestUserMediaId++;var b=e.requestUserMediaId;navigator.mediaDevices.getUserMedia(C).then(function(p){e.unmounted||b!==e.requestUserMediaId?u.stopMediaStream(p):e.handleUserMedia(null,p)}).catch(function(p){e.handleUserMedia(p)})};if("mediaDevices"in navigator)d(r.audioConstraints,r.videoConstraints);else{var c=function(S){return{optional:[{sourceId:S}]}},w=function(S){var v=S.deviceId;return typeof v=="string"?v:Array.isArray(v)&&v.length>0?v[0]:typeof v=="object"&&v.ideal?v.ideal:null};MediaStreamTrack.getSources(function(S){var v=null,C=null;S.forEach(function(F){F.kind==="audio"?v=F.id:F.kind==="video"&&(C=F.id)});var b=w(r.audioConstraints);b&&(v=b);var p=w(r.videoConstraints);p&&(C=p),d(c(v),c(C))})}},u.prototype.handleUserMedia=function(e,r){var d=this.props;if(e||!r){this.setState({hasUserMedia:!1}),d.onUserMediaError(e);return}this.stream=r;try{this.video&&(this.video.srcObject=r),this.setState({hasUserMedia:!0})}catch{this.setState({hasUserMedia:!0,src:window.URL.createObjectURL(r)})}d.onUserMedia(r)},u.prototype.render=function(){var e=this,r=this,d=r.state,c=r.props,w=c.audio;c.forceScreenshotSourceSize;var S=c.disablePictureInPicture;c.onUserMedia,c.onUserMediaError,c.screenshotFormat,c.screenshotQuality,c.minScreenshotWidth,c.minScreenshotHeight,c.audioConstraints,c.videoConstraints,c.imageSmoothing;var v=c.mirrored,C=c.style,b=C===void 0?{}:C,p=c.children,F=U(c,["audio","forceScreenshotSourceSize","disablePictureInPicture","onUserMedia","onUserMediaError","screenshotFormat","screenshotQuality","minScreenshotWidth","minScreenshotHeight","audioConstraints","videoConstraints","imageSmoothing","mirrored","style","children"]),D=v?g(g({},b),{transform:(b.transform||"")+" scaleX(-1)"}):b,G={getScreenshot:this.getScreenshot.bind(this)};return s.createElement(s.Fragment,null,s.createElement("video",g({autoPlay:!0,disablePictureInPicture:S,src:d.src,muted:!w,playsInline:!0,ref:function(q){e.video=q},style:D},F)),p&&p(G))},u.defaultProps={audio:!1,disablePictureInPicture:!1,forceScreenshotSourceSize:!1,imageSmoothing:!0,mirrored:!1,onUserMedia:function(){},onUserMediaError:function(){},screenshotFormat:"image/webp",screenshotQuality:.92},u}(s.Component);o.default=E},react:function(n,o){n.exports=t}}).default})}(_)),_.exports}var Re=Pe();const _e=Z(Re),Oe=({width:i})=>x(V,{width:i,children:[h(W,{size:"threeXL",color:B.gray60,content:$}),x(Se,{children:["This app would like to use your camera.",h(be,{href:me,rel:"noopener noreferrer",target:"_blank",children:"Learn how to allow access."})]})]}),Te=({handleCapture:i,width:l,disabled:t,clearPhotoInProgress:n,setClearPhotoInProgress:o,facingMode:a,setFacingMode:s,testOverride:f})=>{const[g,U]=y.useState(f||"pending"),M=y.useRef(null),[E,m]=y.useState(l),u=y.useCallback(ee(1e3,m),[]);y.useEffect(()=>{u(l)},[l,u]);function e(){if(M.current!==null){const d=M.current.getScreenshot();i(d)}}const r=te();return x(N,{"data-testid":"stCameraInputWebcamComponent",children:[g!=="success"&&!t&&!n?h(Oe,{width:E}):re()&&h(xe,{switchFacingMode:s}),h(V,{"data-testid":"stCameraInputWebcamStyledBox",hidden:g!=="success"&&!t&&!n,width:E,children:!t&&h(_e,{audio:!1,ref:M,screenshotFormat:"image/jpeg",screenshotQuality:1,width:E,height:E*9/16,style:{borderRadius:`${r.radii.default} ${r.radii.default} 0 0`},onUserMediaError:()=>{U("error")},onUserMedia:()=>{U("success"),o(!1)},videoConstraints:{width:{ideal:E},facingMode:a}})}),h(H,{onClick:e,disabled:g!=="success"||t||n,children:"Take Photo"})]})},We=y.memo(Te),Ve=150,ze=ie.getLogger("CameraInput");class Le extends y.PureComponent{constructor(l){super(l),this.localFileIdCounter=1,this.RESTORED_FROM_WIDGET_STRING="RESTORED_FROM_WIDGET",this.formClearHelper=new pe,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=t=>{this.setState({clearPhotoInProgress:t})},this.setFacingMode=()=>{this.setState(t=>({facingMode:t.facingMode===R.USER?R.ENVIRONMENT:R.USER}))},this.handleCapture=t=>{if(t===null)return Promise.resolve();this.setState({imgSrc:t,shutter:!0,minShutterEffectPassed:!1});const n=o=>new Promise(a=>setTimeout(a,o));return je(t,`camera-input-${new Date().toISOString().replace(/:/g,"_")}.jpg`).then(o=>this.props.uploadClient.fetchFileURLs([o]).then(a=>({file:o,fileUrls:a[0]}))).then(({file:o,fileUrls:a})=>this.uploadFile(a,o)).then(()=>n(Ve)).then(()=>{this.setState((o,a)=>({imgSrc:t,shutter:o.shutter,minShutterEffectPassed:!0}))}).catch(o=>{ze.error(o)})},this.removeCapture=()=>{this.state.files.length!==0&&(this.state.files.forEach(t=>this.deleteFile(t.id)),this.setState({imgSrc:null,clearPhotoInProgress:!0}))},this.componentDidUpdate=()=>{if(this.status!=="ready")return;const t=this.createWidgetValue(),{element:n,widgetMgr:o,fragmentId:a}=this.props,s=o.getFileUploaderStateValue(n);oe(t,s)||o.setFileUploaderStateValue(n,t,{fromUi:!0},a)},this.onFormCleared=()=>{this.setState({files:[]},()=>{const t=this.createWidgetValue();if(P(t))return;this.setState({imgSrc:null});const{widgetMgr:n,element:o,fragmentId:a}=this.props;n.setFileUploaderStateValue(o,t,{fromUi:!0},a)})},this.deleteFile=t=>{const n=this.getFile(t);P(n)||(n.status.type==="uploading"&&n.status.abortController.abort(),n.status.type==="uploaded"&&n.status.fileUrls.deleteUrl&&this.props.uploadClient.deleteFile(n.status.fileUrls.deleteUrl),this.removeFile(t))},this.addFile=t=>{this.setState(n=>({files:[...n.files,t]}))},this.removeFile=t=>{this.setState(n=>({files:n.files.filter(o=>o.id!==t)}))},this.getFile=t=>this.state.files.find(n=>n.id===t),this.updateFile=(t,n)=>{this.setState(o=>({files:o.files.map(a=>a.id===t?n:a)}))},this.onUploadComplete=(t,n)=>{this.setState(()=>({shutter:!1}));const o=this.getFile(t);P(o)||o.status.type!=="uploading"||this.updateFile(o.id,o.setStatus({type:"uploaded",fileId:n.fileId,fileUrls:n}))},this.onUploadProgress=(t,n)=>{const o=this.getFile(n);if(P(o)||o.status.type!=="uploading")return;const a=Math.round(t.loaded*100/t.total);o.status.progress!==a&&this.updateFile(n,o.setStatus({type:"uploading",abortController:o.status.abortController,progress:a}))},this.reset=()=>{this.setState({files:[],imgSrc:null})},this.uploadFile=(t,n)=>{const o=new AbortController,a=new z(n.name,n.size,this.nextLocalFileId(),{type:"uploading",abortController:o,progress:1});this.addFile(a),this.props.uploadClient.uploadFile(this.props.element,t.uploadUrl,n,s=>this.onUploadProgress(s,a.id),o.signal).then(()=>this.onUploadComplete(a.id,t)).catch(s=>{s instanceof DOMException&&s.name==="AbortError"||this.updateFile(a.id,a.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:R.USER},{widgetMgr:t,element:n}=this.props,o=t.getFileUploaderStateValue(n);if(P(o))return l;const{uploadedFileInfo:a}=o;return P(a)||a.length===0?l:{files:a.map(s=>{const f=s.name,g=s.size,U=s.fileId,M=s.fileUrls;return new z(f,g,this.nextLocalFileId(),{type:"uploaded",fileId:U,fileUrls:M})}),imgSrc:a.length===0?"":this.RESTORED_FROM_WIDGET_STRING,shutter:!1,minShutterEffectPassed:!1,clearPhotoInProgress:!1,facingMode:R.USER}}componentWillUnmount(){this.formClearHelper.disconnect()}get status(){const l=t=>t.status.type==="uploading";return this.state.files.some(l)?"updating":"ready"}componentDidMount(){const l=this.createWidgetValue(),{element:t,widgetMgr:n,fragmentId:o}=this.props;n.getFileUploaderStateValue(t)===void 0&&n.setFileUploaderStateValue(t,l,{fromUi:!1},o)}createWidgetValue(){const l=this.state.files.filter(t=>t.status.type==="uploaded").map(t=>{const{name:n,size:o,status:a}=t;return new ne({fileId:a.fileId,fileUrls:a.fileUrls,name:n,size:o})});return new ae({uploadedFileInfo:l})}render(){const{element:l,widgetMgr:t,disabled:n,width:o}=this.props;return this.formClearHelper.manageFormClearListener(t,l.formId,this.onFormCleared),x(N,{className:"stCameraInput","data-testid":"stCameraInput",children:[h(ce,{label:l.label,disabled:n,labelVisibility:se(l.labelVisibility?.value),children:l.help&&h(le,{children:h(de,{content:l.help,placement:j.TOP_RIGHT})})}),this.state.imgSrc?x(ue,{children:[h(V,{width:o,children:this.state.imgSrc!==this.RESTORED_FROM_WIDGET_STRING&&h(ye,{src:this.state.imgSrc,alt:"Snapshot",opacity:this.state.shutter||!this.state.minShutterEffectPassed?"50%":"100%",width:o,height:o*9/16})}),h(H,{onClick:this.removeCapture,progress:this.getProgress(),disabled:!!this.getProgress()||n,children:this.getProgress()?"Uploading...":x(we,{children:[h(W,{content:A,margin:"0 xs 0 0",size:"sm"})," Clear photo"]})})]}):h(We,{handleCapture:this.handleCapture,width:o,disabled:n,clearPhotoInProgress:this.state.clearPhotoInProgress,setClearPhotoInProgress:this.setClearPhotoInProgress,facingMode:this.state.facingMode,setFacingMode:this.setFacingMode,testOverride:this.props.testOverride})]})}nextLocalFileId(){return this.localFileIdCounter++}}function je(i,l){return fetch(i).then(t=>t.arrayBuffer()).then(t=>new File([t],l,{type:"image/jpeg"}))}const De=fe(Le);export{De as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{R as f,a7 as h,B as i,r as d,u as S,j as e,a as p,b as F,c as R,D as C,d as I,a8 as M}from"./index.DMxc2XFp.js";import{a9 as A}from"./index.DMxc2XFp.js";import{F as U,u as E}from"./FormClearHelper.CG2XN1_g.js";function x(a){const{disabled:c,element:t,widgetMgr:o,fragmentId:u}=a,{formId:r}=t,l=t.shortcut?t.shortcut:void 0,{formsData:B}=f(h),b=B.formsWithUploads.has(r);let n=i.SECONDARY_FORM_SUBMIT;t.type==="primary"?n=i.PRIMARY_FORM_SUBMIT:t.type==="tertiary"&&(n=i.TERTIARY_FORM_SUBMIT);const s=c||b;d.useEffect(()=>(o.addSubmitButton(r,t),()=>o.removeSubmitButton(r,t)),[o,r,t]);const m=d.useCallback(()=>{s||o.submitForm(t.formId,u,t)},[s,o,t,u]);return S({shortcut:l,disabled:s,onActivate:m}),e(I,{className:"stFormSubmitButton","data-testid":"stFormSubmitButton",children:e(p,{help:t.help,containerWidth:!0,children:e(F,{kind:n,size:R.SMALL,containerWidth:!0,disabled:s,onClick:m,children:e(C,{icon:t.icon,label:t.label,shortcut:l})})})})}function T(a){return e(M,{children:e(x,{...a})})}export{U as FormClearHelper,x as FormSubmitButton,T as FormSubmitContent,A as default,E as useFormClearHelper};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as o,L as M,F as T,B as m,u as U,l as I,j as u,b as A,c as j,D as F,a as N,G as Y}from"./index.DMxc2XFp.js";import{c as R}from"./createDownloadLinkElement.ZaXNnPK4.js";function z(S){const{disabled:a,element:r,widgetMgr:B,endpoints:t,fragmentId:g}=S,{help:v,label:x,icon:L,ignoreRerun:h,type:p,url:k,deferredFileId:n}=r,b=r.shortcut?r.shortcut:void 0,[C,f]=o.useState(!1),[i,s]=o.useState(null),{enforceDownloadInNewTab:d=!1}=o.useContext(M),{requestDeferredFile:D}=o.useContext(T);let w=m.SECONDARY;p==="primary"?w=m.PRIMARY:p==="tertiary"&&(w=m.TERTIARY);const c=o.useMemo(()=>t.buildDownloadUrl(k),[t,k]);o.useEffect(()=>{!!n?.length||t.checkSourceUrlResponse(c,"Download Button")},[c,t,n]);const E=o.useCallback(async()=>{if(!D||!n){s("Deferred download not properly configured");return}f(!0),s(null);try{const e=await D(n);if(e.errorMsg){s(e.errorMsg),f(!1);return}const l=t.buildDownloadUrl(e.url);t.checkSourceUrlResponse(l,"Download Button"),R({filename:"",url:l,enforceDownloadInNewTab:d}).click()}catch(e){const l=e instanceof Error?e.message:"Download failed";s(l)}finally{f(!1)}},[D,n,t,d]),y=o.useCallback(()=>{if(a)return;h||B.setTriggerValue(r,{fromUi:!0},g),!!n?.length?E():R({filename:"",url:c,enforceDownloadInNewTab:d}).click()},[a,h,B,r,g,n,E,c,d]);return U({shortcut:b,disabled:a,onActivate:y}),o.useEffect(()=>{if(i){const e=setTimeout(()=>s(null),5e3);return()=>clearTimeout(e)}},[i]),I("div",{className:"stDownloadButton","data-testid":"stDownloadButton",children:[u(N,{help:v,containerWidth:!0,children:u(A,{kind:w,size:j.SMALL,disabled:a||C,onClick:y,containerWidth:!0,children:u(F,{icon:C?"spinner":L,label:x,shortcut:b})})}),i&&u(Y,{"data-testid":"stDownloadButtonError",children:i})]})}const K=o.memo(z);export{K as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,E as L,_ as D,L as Te,e as de,n as P,W as ie,bU as Le,bN as De,bM as Be,x as d,j as n,Z as Ve,l as F,B as We,ax as ze,b as Me,m as Ne,T as qe,P as Oe,ac as He}from"./index.DMxc2XFp.js";import{u as $e}from"./useWaveformController.WxVzpzEX.js";import{T as je,a as ce}from"./Toolbar.B2qFUmd9.js";import{u as _e,F as Xe}from"./FormClearHelper.CG2XN1_g.js";import{c as Ge}from"./createDownloadLinkElement.ZaXNnPK4.js";import{E as Ke}from"./urls.BwSlolu9.js";import{F as Ze,D as Je}from"./FileDownload.esm.Dx0vI3vH.js";var ue=t.forwardRef(function(e,r){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return t.createElement(L,D({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:r}),t.createElement("g",{fill:"none"},t.createElement("rect",{width:24,height:24}),t.createElement("rect",{width:24,height:24}),t.createElement("rect",{width:24,height:24})),t.createElement("path",{d:"M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z"}),t.createElement("path",{d:"M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"}))});ue.displayName="Mic";var fe=t.forwardRef(function(e,r){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return t.createElement(L,D({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:r}),t.createElement("rect",{width:24,height:24,fill:"none"}),t.createElement("path",{d:"M8 19c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2s-2 .9-2 2v10c0 1.1.9 2 2 2zm6-12v10c0 1.1.9 2 2 2s2-.9 2-2V7c0-1.1-.9-2-2-2s-2 .9-2 2z"}))});fe.displayName="Pause";var pe=t.forwardRef(function(e,r){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return t.createElement(L,D({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:r}),t.createElement("rect",{width:24,height:24,fill:"none"}),t.createElement("path",{d:"M8 6.82v10.36c0 .79.87 1.27 1.54.84l8.14-5.18a1 1 0 000-1.69L9.54 5.98A.998.998 0 008 6.82z"}))});pe.displayName="PlayArrow";var me=t.forwardRef(function(e,r){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return t.createElement(L,D({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:r}),t.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),t.createElement("path",{d:"M17.65 6.35a7.95 7.95 0 00-6.48-2.31c-3.67.37-6.69 3.35-7.1 7.02C3.52 15.91 7.27 20 12 20a7.98 7.98 0 007.21-4.56c.32-.67-.16-1.44-.9-1.44-.37 0-.72.2-.88.53a5.994 5.994 0 01-6.8 3.31c-2.22-.49-4.01-2.3-4.48-4.52A6.002 6.002 0 0112 6c1.66 0 3.14.69 4.22 1.78l-1.51 1.51c-.63.63-.19 1.71.7 1.71H19c.55 0 1-.45 1-1V6.41c0-.89-1.08-1.34-1.71-.71l-.64.65z"}))});me.displayName="Refresh";var ge=t.forwardRef(function(e,r){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return t.createElement(L,D({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:r}),t.createElement("g",{fill:"none"},t.createElement("rect",{width:24,height:24}),t.createElement("rect",{width:24,height:24})),t.createElement("path",{fillRule:"evenodd",d:"M9 16h6c.55 0 1-.45 1-1V9c0-.55-.45-1-1-1H9c-.55 0-1 .45-1 1v6c0 .55.45 1 1 1zm3-14C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2z"}))});ge.displayName="StopCircle";const Qe=(e,r)=>{const{enforceDownloadInNewTab:o=!1}=t.useContext(Te);return t.useCallback(()=>{if(!e)return;const l=Ge({enforceDownloadInNewTab:o,url:e,filename:r});l.style.display="none",document.body.appendChild(l),l.click(),document.body.removeChild(l)},[e,o,r])},H=({widgetMgr:e,id:r,formId:o,key:c,defaultValue:l})=>{t.useEffect(()=>{const s=e.getElementState(r,c);de(s)&&P(l)&&e.setElementState(r,c,l)},[e,r,c,l]);const[S,u]=t.useState(e.getElementState(r,c)??l),h=t.useCallback(s=>{e.setElementState(r,c,s),u(s)},[e,r,c]),y=t.useMemo(()=>({formId:o||""}),[o]),b=t.useCallback(()=>h(l),[l,h]);return _e({element:y,widgetMgr:e,onFormCleared:b}),[S,h]},Ye=async({files:e,uploadClient:r,widgetMgr:o,widgetInfo:c,fragmentId:l,signal:S})=>{let u=[];try{u=await r.fetchFileURLs(e)}catch(s){return{successfulUploads:[],failedUploads:e.map(i=>({file:i,error:ie(s)}))}}const h=Le(e,u),y=[],b=[];return await Promise.all(h.map(async([s,i])=>{if(!s||!i?.uploadUrl||!i.fileId)return{file:s,fileUrl:i,error:new Error("No upload URL found")};try{await r.uploadFile({id:i.fileId,formId:c.formId||""},i.uploadUrl,s,void 0,S),y.push({fileUrl:i,file:s})}catch(N){const f=ie(N);b.push({file:s,error:f})}})),o.setFileUploaderStateValue(c,new De({uploadedFileInfo:y.map(({file:s,fileUrl:i})=>new Be({fileId:i.fileId,fileUrls:i,name:s.webkitRelativePath||s.name,size:s.size}))}),{fromUi:!0},l),{successfulUploads:y,failedUploads:b}},et=d("div",{target:"e3q8yfp0"})(),se=d("div",{target:"e3q8yfp1"})(({theme:e,disabled:r})=>({height:e.sizes.largestElementHeight,width:"100%",background:e.colors.secondaryBg,borderRadius:e.radii.default,marginBottom:e.spacing.twoXS,display:"flex",alignItems:"center",position:"relative",paddingLeft:e.spacing.xs,paddingRight:e.spacing.sm,border:e.colors.widgetBorderColor?`${e.sizes.borderWidth} solid ${e.colors.widgetBorderColor}`:void 0,cursor:r?"not-allowed":"auto",overflow:"hidden"})),tt=d("div",{target:"e3q8yfp2"})({flex:1}),rt=d("div",{target:"e3q8yfp3"})(({show:e,theme:r})=>({display:e?"block":"none",position:"relative",height:r.sizes.largestElementHeight,"& > div":{position:"absolute",top:0,left:0,width:"100%",height:"100%",display:"flex",alignItems:"center"}})),ot=d("span",{target:"e3q8yfp4"})(({theme:e,isPlayingOrRecording:r,disabled:o})=>({margin:e.spacing.sm,fontFamily:e.fonts.monospace,color:o?e.colors.fadedText40:r?e.colors.bodyText:e.colors.fadedText60,backgroundColor:e.colors.secondaryBg,fontSize:e.fontSizes.sm})),he=d("div",{target:"e3q8yfp5"})({width:"100%",textAlign:"center",overflow:"hidden"}),ye=d("span",{target:"e3q8yfp6"})(({theme:e})=>({color:e.colors.bodyText})),nt=d("a",{target:"e3q8yfp7"})(({theme:e})=>({color:e.colors.link,textDecoration:e.linkUnderline?"underline":"none"})),at=d("div",{target:"e3q8yfp8"})(({theme:e})=>({flex:1,height:e.sizes.largestElementHeight,display:"flex",justifyContent:"center",alignItems:"center"})),lt=d("div",{target:"e3q8yfp9"})(({theme:e})=>{const r="0.625em";return{opacity:.2,width:"100%",height:r,backgroundSize:r,backgroundImage:`radial-gradient(${e.colors.fadedText10} 40%, transparent 40%)`,backgroundRepeat:"repeat"}}),it=d("span",{target:"e3q8yfp10"})(({theme:e})=>({"& > button":{color:e.colors.primary,padding:e.spacing.threeXS},"& > button:hover, & > button:focus":{color:e.colors.redColor}})),ct=d("span",{target:"e3q8yfp11"})(({theme:e})=>({"& > button":{padding:e.spacing.threeXS,color:e.colors.fadedText60},"& > button:hover, & > button:focus":{color:e.colors.bodyText}})),be=d("span",{target:"e3q8yfp12"})(({theme:e})=>({"& > button":{padding:e.spacing.threeXS,color:e.colors.fadedText60},"& > button:hover, & > button:focus":{color:e.colors.bodyText}})),$=d("div",{target:"e3q8yfp13"})(({theme:e})=>({display:"flex",justifyContent:"center",alignItems:"center",flexGrow:0,flexShrink:1,padding:e.spacing.xs,gap:e.spacing.twoXS,marginRight:e.spacing.twoXS})),st=d("div",{target:"e3q8yfp14"})(({theme:e})=>({marginLeft:e.spacing.sm})),T=({onClick:e,disabled:r,ariaLabel:o,iconContent:c})=>n(Me,{kind:We.BORDERLESS_ICON,onClick:e,disabled:r,"aria-label":o,containerWidth:!0,"data-testid":"stAudioInputActionButton",children:n(ze,{content:c,size:"lg",color:"inherit"})}),dt=({disabled:e,stopRecording:r})=>n(it,{children:n(T,{onClick:r,disabled:e,ariaLabel:"Stop recording",iconContent:ge})}),ut=({disabled:e,isPlaying:r,onClickPlayPause:o})=>n(be,{children:r?n(T,{onClick:o,disabled:e,ariaLabel:"Pause",iconContent:fe}):n(T,{onClick:o,disabled:e,ariaLabel:"Play",iconContent:pe})}),ft=({disabled:e,startRecording:r})=>n(ct,{children:n(T,{onClick:r,disabled:e,ariaLabel:"Record",iconContent:ue})}),pt=({onClick:e})=>n(be,{children:n(T,{disabled:!1,onClick:e,ariaLabel:"Reset",iconContent:me})}),mt=({disabled:e,isRecording:r,isPlaying:o,isUploading:c,isError:l,recordingUrlExists:S,startRecording:u,stopRecording:h,onClickPlayPause:y,onClear:b})=>l?n($,{children:n(pt,{onClick:b})}):c?n($,{children:n(Ve,{size:"base",iconValue:"spinner"})}):F($,{children:[r?n(dt,{disabled:e,stopRecording:h}):n(ft,{disabled:e,startRecording:u}),S&&n(ut,{disabled:e,isPlaying:o,onClickPlayPause:y})]}),gt=t.memo(mt),ht=()=>n(he,{children:n(ye,{children:"An error has occurred, please try again."})}),yt=t.memo(ht),R="00:00",k=e=>{const r=Math.floor(e/1e3),o=Math.floor(r/60),c=Math.floor(o/60),l=r%60,S=o%60,u=l.toString().padStart(2,"0"),h=S.toString().padStart(2,"0"),y=c.toString().padStart(2,"0");return o<60?`${h}:${u}`:`${y}:${h}:${u}`},bt=()=>F(he,{children:[n(ye,{children:"This app would like to use your microphone."})," ",n(nt,{href:Ke,rel:"noopener noreferrer",target:"_blank",children:"Learn how to allow access."})]}),vt=t.memo(bt),St=()=>n(at,{children:n(lt,{})}),wt=t.memo(St),Ct=({element:e,uploadClient:r,widgetMgr:o,fragmentId:c,disabled:l})=>{const S=t.useRef(null),[u,h]=t.useState(!1),[y,b]=t.useState(!1),[s,i]=t.useState(!1),[N,f]=t.useState(R),[B,V]=H({widgetMgr:o,id:e.id,key:"deleteFileUrl",defaultValue:null}),[g,W]=H({widgetMgr:o,id:e.id,key:"recordingUrl",defaultValue:null}),[q,A]=H({widgetMgr:o,id:e.id,formId:e.formId,key:"recordingTime",defaultValue:R}),U=t.useRef(null),w=t.useRef(null),p=t.useRef(null),j=e.id,C=e.formId,ve=t.useCallback(async a=>{U.current&&U.current.abort();const v=new AbortController;U.current=v;try{if(b(!0),P(C)&&o.setFormsWithUploadsInProgress(new Set([C])),v.signal.aborted)return;let m;try{m=URL.createObjectURL(a),w.current&&w.current!==m&&URL.revokeObjectURL(w.current),w.current=m}catch{i(!0),b(!1),P(C)&&o.setFormsWithUploadsInProgress(new Set);return}if(v.signal.aborted){URL.revokeObjectURL(m),w.current=null;return}W(m);const Ie=new Date().toISOString().slice(0,16).replace(/:/g,"-"),Pe=new File([a],`${Ie}_audio.wav`,{type:a.type});try{const{successfulUploads:Fe,failedUploads:xe}=await Ye({files:[Pe],uploadClient:r,widgetMgr:o,widgetInfo:{id:j,formId:C},fragmentId:c,signal:v.signal});if(v.signal.aborted)return;if(xe.length>0){i(!0);return}i(!1);const le=Fe[0];le?.fileUrl?.deleteUrl&&V(le.fileUrl.deleteUrl)}catch{v.signal.aborted||i(!0)}finally{P(C)&&o.setFormsWithUploadsInProgress(new Set),v.signal.aborted||b(!1)}}catch{v.signal.aborted||(i(!0),b(!1)),P(C)&&o.setFormsWithUploadsInProgress(new Set)}},[r,o,j,C,c,V,W]),z=t.useRef(null),_=$e({containerRef:S,sampleRate:e.sampleRate??void 0,waveformPadding:4,events:{onPermissionDenied:()=>{h(!0)},onError:()=>{i(!0)},onRecordStart:()=>{A(R),f(R)},onRecordReady:()=>{const a=k(z.current?.playback.getDurationMs()??0);A(a),f(a)},onApprove:ve,onCancel:()=>{A(R),f(R)},onProgressMs:a=>{A(k(a))},onPlaybackPause:()=>{f(k(z.current?.playback.getCurrentTimeMs()??0))},onPlaybackFinish:()=>{f(k(z.current?.playback.getDurationMs()??0))}}});z.current=_;const{state:M,isPlaybackPlaying:I,start:X,stop:G,approve:K,cancel:Z,playback:{play:J,pause:Q,load:Y,getCurrentTimeMs:x,getDurationMs:ee}}=_,E=t.useCallback(async({updateWidgetManager:a,deleteFile:v})=>{const m=g;if(m&&w.current===m&&(URL.revokeObjectURL(m),w.current=null),p.current&&(cancelAnimationFrame(p.current),p.current=null),W(null),V(null),f(R),A(R),Z(),a&&o.setFileUploaderStateValue(e,{},{fromUi:!0},c),v&&B)try{await r.deleteFile(B)}catch{}P(m)&&URL.revokeObjectURL(m)},[B,g,r,Z,e,o,c,A,V,W]);t.useEffect(()=>{const a=()=>{I&&(f(k(x())),p.current=requestAnimationFrame(a))};return I?p.current=requestAnimationFrame(a):p.current&&(cancelAnimationFrame(p.current),p.current=null),()=>{p.current&&(cancelAnimationFrame(p.current),p.current=null)}},[I,x]),t.useEffect(()=>{if(!g)return;let a=!1;return f(q),(async()=>{try{if(await Y(g),a)return;const m=ee();m>0&&f(k(m))}catch{a||i(!0)}})(),()=>{a=!0}},[g,q,Y,ee]),t.useEffect(()=>{if(de(C))return;const a=new Xe;return a.manageFormClearListener(o,C,()=>{E({updateWidgetManager:!0,deleteFile:!1})}),()=>a.disconnect()},[C,E,o]),t.useEffect(()=>()=>{U.current&&(U.current.abort(),U.current=null),p.current&&(cancelAnimationFrame(p.current),p.current=null),w.current&&(URL.revokeObjectURL(w.current),w.current=null)},[]);const Se=t.useCallback(async()=>{try{if(I){const a=x();Q(),f(k(a))}else M==="idle"&&g&&(x()<=100&&f(R),await J())}catch{i(!0)}},[I,x,Q,J,g,M]),te=t.useCallback(async()=>{g&&await E({updateWidgetManager:!1,deleteFile:!0});try{f(R),await X()}catch{}},[E,g,X]),re=t.useCallback(async()=>{try{const{blob:a}=await G();await K(a)}catch{i(!0)}},[K,G]),oe=Qe(g,"recording.wav"),we=t.useCallback(()=>{te()},[te]),Ce=t.useCallback(()=>{re()},[re]),Re=t.useCallback(()=>{E({updateWidgetManager:!1,deleteFile:!0}),i(!1)},[E]),Ee=t.useCallback(()=>{oe()},[oe]),ke=t.useCallback(()=>{E({updateWidgetManager:!0,deleteFile:!0})},[E]),O=M==="recording",ne=I,Ae=O?q:N,ae=M==="idle"&&!u&&!g,Ue=u||ae||s;return F(et,{className:"stAudioInput","data-testid":"stAudioInput",children:[n(He,{label:e.label,disabled:l,labelVisibility:Ne(e.labelVisibility?.value),children:e.help&&n(st,{children:n(qe,{content:e.help,placement:Oe.TOP})})}),F(se,{disabled:l,children:[F(je,{isFullScreen:!1,disableFullscreenMode:!0,target:se,children:[g&&n(ce,{label:"Download as WAV",icon:Ze,onClick:Ee}),B&&n(ce,{label:"Clear recording",icon:Je,onClick:ke})]}),n(gt,{isRecording:O,isPlaying:ne,isUploading:y,isError:s,recordingUrlExists:!!g,startRecording:we,stopRecording:Ce,onClickPlayPause:()=>void Se(),onClear:Re,disabled:l||u}),F(tt,{children:[s&&n(yt,{}),ae&&n(wt,{}),u&&n(vt,{}),n(rt,{"data-testid":"stAudioInputWaveSurfer",ref:S,show:!Ue})]}),n(ot,{isPlayingOrRecording:O||ne,disabled:l,"data-testid":"stAudioInputWaveformTimeCode",children:Ae})]})]})},Ft=t.memo(Ct);export{Ft as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{x as u,r as L,R as C,l as h,j as i,O as E,S as b,Q as v}from"./index.DMxc2XFp.js";import{w as T,E as W}from"./withFullScreenWrapper.CrHddARq.js";import{S as p,T as y}from"./Toolbar.B2qFUmd9.js";const F=u("div",{target:"e1mq0gaz0"})(({theme:e,shouldStretch:t})=>({display:"flex",flexDirection:"row",flexWrap:"wrap",rowGap:e.spacing.lg,maxWidth:"100%",width:t?"100%":"fit-content"})),R=u("div",{target:"e1mq0gaz1"})(({theme:e,shouldStretch:t})=>({display:"flex",flexDirection:"column",alignItems:"stretch",width:t?"100%":"auto",flexGrow:t?1:0,">img":{borderRadius:e.radii.default}})),j=u("div",{target:"e1mq0gaz2"})(({theme:e})=>({textAlign:"center",marginTop:e.spacing.xs,wordWrap:"break-word",padding:e.spacing.threeXS})),q=v.getLogger("ImageList");function H(e,t,r){if(e){if(e.useStretch)return r;if(e.useContent)return;if(e.pixelWidth)return e.pixelWidth}if(t!=null)switch(t){case-1:case-3:case-4:return;case-2:case-5:return r;default:return t>0?t:void 0}}const M=({itemKey:e,image:t,imgStyle:r,buildMediaURL:l,handleImageError:s,shouldStretch:d})=>{const o=E(t.url);return h(R,{"data-testid":"stImageContainer",shouldStretch:d,children:[i("img",{style:r,src:l(t.url),alt:e,onError:s,crossOrigin:o}),t.caption&&i(j,{"data-testid":"stImageCaption",style:r,children:i(b,{source:t.caption,allowHTML:!1,isCaption:!0,isLabel:!0})})]})};function O({element:e,endpoints:t,widthConfig:r,disableFullscreenMode:l}){const{expanded:s,width:d,height:o,expand:x,collapse:f}=C(W),g=d||0,I=H(r,e.width,g),m=r?.useStretch||e.width===-5,a={};o&&s?(a.maxHeight=o,a.objectFit="contain",a.width="100%"):(a.width=I??"100%",a.maxWidth="100%");const S=c=>{const n=c.currentTarget.src;q.error(`Client Error: Image source error - ${n}`),t.sendClientErrorToHost("Image","Image source failed to load","onerror triggered",n)};return h(p,{width:g,height:o,useContainerWidth:s,topCentered:!0,children:[i(y,{target:p,isFullScreen:s,onExpand:x,onCollapse:f,disableFullscreenMode:l}),i(F,{className:"stImage","data-testid":"stImage",shouldStretch:m,children:e.imgs.map((c,n)=>i(M,{itemKey:n.toString(),image:c,imgStyle:a,buildMediaURL:w=>t.buildMediaURL(w),handleImageError:S,shouldStretch:m},n))})]})}const z=T(O),A=L.memo(z);export{A as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{m as W,aA as _,x as q,r as i,f as G,g as K,aa as H,l as $,j as u,ab as M,T as N,P as J,ac as Q,ae as X}from"./index.DMxc2XFp.js";import{I as Y}from"./InputInstructions.Cj5-1zf6.js";import{u as Z}from"./useBasicWidgetState.Bfp6TnSw.js";import{u as tt,a as et,b as ot}from"./useUpdateUiValue.DHx8TzX6.js";import{u as at,T as it}from"./useTextInputAutoExpand.QepX7n8Y.js";import{u as st}from"./uniqueId.CtqIr-Yh.js";import"./FormClearHelper.CG2XN1_g.js";import"./inputUtils.CptNuJwn.js";import"./base-input.o9tL8MDP.js";const rt=(e,t)=>{let a="auto";if(e.heightConfig?.useStretch)a="100%";else if(e.heightConfig?.pixelHeight&&e.heightConfig.pixelHeight>0){const s=W(t.labelVisibility?.value)===_.Collapsed?2:30,l=e.heightConfig.pixelHeight-s;a=`${Math.max(0,l)}px`}return a},lt=q("div",{target:"e1r0q00f0"})({height:"100%",display:"flex",flexDirection:"column"}),S=(e,t)=>e.getStringValue(t)??t.default??null,nt=e=>e.default??null,dt=e=>e.value??null,ut=(e,t,a,s)=>{t.setStringValue(e,a.value,{fromUi:a.fromUi},s)},ct=({disabled:e,element:t,widgetMgr:a,fragmentId:s,outerElement:l})=>{const h=i.useRef(st("text_area_")).current,{width:y,elementRef:I}=G(),[r,g]=i.useState(!1),[V,x]=i.useState(!1),n=l.heightConfig?.useContent??!1,A=l.heightConfig?.useStretch??!1,v=rt(l,t),C=i.useRef(null),[d,p]=i.useState(()=>S(a,t)??null),F=i.useCallback(()=>{p(t.default??null),g(!0)},[t]),[R,f]=Z({getStateFromWidgetMgr:S,getDefaultStateFromProto:nt,getCurrStateFromProto:dt,updateWidgetMgrState:ut,element:t,widgetMgr:a,fragmentId:s,onFormCleared:F});tt(R,d,p,r);const o=K(),{height:L,maxHeight:P,updateScrollHeight:T}=at({textareaRef:C,dependencies:[t.placeholder]}),m=i.useCallback(()=>{g(!1),f({value:d,fromUi:!0})},[d,f]),k=i.useCallback(()=>{r&&m(),x(!1)},[r,m]),z=i.useCallback(()=>{x(!0)},[]),B=i.useCallback(()=>{n&&T()},[n,T]),D=et({formId:t.formId,maxChars:t.maxChars,setDirty:g,setUiValue:p,setValueWithSource:f,additionalAction:B}),E=ot(t.formId,m,r,a,s,!0),{placeholder:U,formId:b}=t,j=H({formId:b})?a.allowFormEnterToSubmit(b):r,w=V&&y>o.breakpoints.hideWidgetDetails;return $(lt,{className:"stTextArea","data-testid":"stTextArea",ref:I,children:[u(Q,{label:t.label,disabled:e,labelVisibility:W(t.labelVisibility?.value),htmlFor:h,children:t.help&&u(M,{children:u(N,{content:t.help,placement:J.TOP_RIGHT})})}),u(it,{inputRef:n?C:void 0,value:d??"",placeholder:U,onBlur:k,onFocus:z,onChange:D,onKeyDown:E,"aria-label":t.label,disabled:e,id:h,overrides:{Input:{style:{fontWeight:o.fontWeights.normal,lineHeight:o.lineHeights.inputWidget,height:n?L:v,maxHeight:n?P:"",minHeight:o.sizes.largestElementHeight,resize:A?"none":"vertical",paddingRight:o.spacing.md,paddingLeft:o.spacing.md,paddingBottom:o.spacing.md,paddingTop:o.spacing.md,"::placeholder":{color:o.colors.fadedText60}}},Root:{props:{"data-testid":"stTextAreaRootElement"},style:({$isFocused:O})=>{const c=X(o.colors,O);return{borderLeftWidth:o.sizes.borderWidth,borderRightWidth:o.sizes.borderWidth,borderTopWidth:o.sizes.borderWidth,borderBottomWidth:o.sizes.borderWidth,borderTopColor:c,borderRightColor:c,borderBottomColor:c,borderLeftColor:c,flexGrow:1}}}}}),w&&u(Y,{dirty:r,value:d??"",maxLength:t.maxChars,type:"multiline",inForm:H({formId:b}),allowEnterToSubmit:j})]})},Ht=i.memo(ct);export{Ht as default};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{bR as de,cm as ce,cn as pe,co as fe,cp as ge,cq as ye,aJ as me,am as ve,b8 as be,cr as he,aK as Se,c7 as Oe,al as K,cs as Ce,r as k,az as Ie,e as J,g as Pe,l as $e,j as z,m as _e,ab as Te,T as Ee,P as Re,ac as we,av as De,ae as xe}from"./index.DMxc2XFp.js";import{u as Ae}from"./useBasicWidgetState.Bfp6TnSw.js";import{S as We,a as Be}from"./styled-components.C3R090At.js";import{T as Ne}from"./timepicker.BdhzPxrv.js";import"./FormClearHelper.CG2XN1_g.js";import"./possibleConstructorReturn.DD9NK1Z8.js";import"./createSuper.RBO59fEm.js";var Me=de.Consumer;const Le=Object.freeze(Object.defineProperty({__proto__:null,ThemeConsumer:Me,ThemeProvider:ce,createThemedStyled:pe,createThemedUseStyletron:fe,createThemedWithStyle:ge,expandBorderStyles:ye,hexToRgb:me,styled:ve,useStyletron:be,withStyle:he,withWrapper:Se},Symbol.toStringTag,{value:"Module"}));var C={};const Y=Oe(Le);var D={},X;function Fe(){if(X)return D;X=1,Object.defineProperty(D,"__esModule",{value:!0}),D.STATE_CHANGE_TYPE=D.SIZE=D.ENHANCER_POSITION=D.CUSTOM_INPUT_TYPE=D.ADJOINED=void 0;var g={change:"change"};D.STATE_CHANGE_TYPE=g;var c={textarea:"textarea"};D.CUSTOM_INPUT_TYPE=c;var h={none:"none",left:"left",right:"right",both:"both"};D.ADJOINED=h;var m={mini:"mini",default:"default",compact:"compact",large:"large"};D.SIZE=m;var b={start:"start",end:"end"};return D.ENHANCER_POSITION=b,D}var q={},A={},H={},Q;function ze(){if(Q)return H;Q=1,Object.defineProperty(H,"__esModule",{value:!0}),H.default=c;function g(m){"@babel/helpers - typeof";return g=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(b){return typeof b}:function(b){return b&&typeof Symbol=="function"&&b.constructor===Symbol&&b!==Symbol.prototype?"symbol":typeof b},g(m)}function c(m){m=m||{};for(var b=arguments.length<=1?0:arguments.length-1,v,y,S=0;S<b;S++){v=(S+1<1||arguments.length<=S+1?void 0:arguments[S+1])||{};for(var f in v)g(v[f])!==void 0&&(y=v[f],h(y)?m[f]=c(m[f]||Array.isArray(y)&&[]||{},y):m[f]=y)}return m}function h(m){return Array.isArray(m)||{}.toString.call(m)=="[object Object]"}return H}var ee;function ae(){if(ee)return A;ee=1,Object.defineProperty(A,"__esModule",{value:!0}),A.getOverride=R,A.getOverrideProps=$,A.getOverrides=L,A.mergeConfigurationOverrides=M,A.mergeOverride=x,A.mergeOverrides=N,A.toObjectOverride=_,A.useOverrides=F;var g=v(K()),c=Ce(),h=m(ze());function m(i){return i&&i.__esModule?i:{default:i}}function b(i){if(typeof WeakMap!="function")return null;var t=new WeakMap,u=new WeakMap;return(b=function(r){return r?u:t})(i)}function v(i,t){if(i&&i.__esModule)return i;if(i===null||P(i)!=="object"&&typeof i!="function")return{default:i};var u=b(t);if(u&&u.has(i))return u.get(i);var s={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in i)if(a!=="default"&&Object.prototype.hasOwnProperty.call(i,a)){var l=r?Object.getOwnPropertyDescriptor(i,a):null;l&&(l.get||l.set)?Object.defineProperty(s,a,l):s[a]=i[a]}return s.default=i,u&&u.set(i,s),s}function y(){return y=Object.assign?Object.assign.bind():function(i){for(var t=1;t<arguments.length;t++){var u=arguments[t];for(var s in u)Object.prototype.hasOwnProperty.call(u,s)&&(i[s]=u[s])}return i},y.apply(this,arguments)}function S(i,t){var u=Object.keys(i);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);t&&(s=s.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),u.push.apply(u,s)}return u}function f(i){for(var t=1;t<arguments.length;t++){var u=arguments[t]!=null?arguments[t]:{};t%2?S(Object(u),!0).forEach(function(s){T(i,s,u[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(u)):S(Object(u)).forEach(function(s){Object.defineProperty(i,s,Object.getOwnPropertyDescriptor(u,s))})}return i}function T(i,t,u){return t in i?Object.defineProperty(i,t,{value:u,enumerable:!0,configurable:!0,writable:!0}):i[t]=u,i}function P(i){"@babel/helpers - typeof";return P=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},P(i)}function R(i){return(0,c.isValidElementType)(i)?i:i&&P(i)==="object"?i.component:i}function $(i){return i&&P(i)==="object"?P(i.props)==="object"?f(f({},i.props),{},{$style:i.style}):{$style:i.style}:{}}function _(i){return(0,c.isValidElementType)(i)?{component:i}:i||{}}function L(i,t){var u=R(i)||t;if(i&&P(i)==="object"&&typeof i.props=="function"){var s=g.forwardRef(function(a,l){var n=i.props(a),e=$(f(f({},i),{},{props:n}));return g.createElement(u,y({ref:l},e))});return s.displayName=u.displayName,[s,{}]}var r=$(i);return[u,r]}function N(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},u=Object.assign({},i,t),s=Object.keys(u);return s.reduce(function(r,a){return r[a]=x(_(i[a]),_(t[a])),r},{})}function x(i,t){var u=f(f({},i),t);return i.props&&t.props&&(u.props=M(i.props,t.props)),i.style&&t.style&&(u.style=M(i.style,t.style)),u}function M(i,t){return P(i)==="object"&&P(t)==="object"?(0,h.default)({},i,t):function(){return(0,h.default)({},typeof i=="function"?i.apply(void 0,arguments):i,typeof t=="function"?t.apply(void 0,arguments):t)}}function F(i){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return g.useMemo(function(){return Object.keys(i).reduce(function(u,s){return u[s]=L(t[s],i[s]),u},{})},[t])}return A}var j={},Z={},te;function Ze(){if(te)return Z;te=1,Object.defineProperty(Z,"__esModule",{value:!0}),Z.Svg=void 0,Z.getSvgStyles=c;var g=Y;function c(m){var b=m.$theme,v=m.$size,y=m.$color,S=b.sizing.scale600;v&&(b.sizing[v]?S=b.sizing[v]:typeof v=="number"?S="".concat(v,"px"):S=v);var f="currentColor";return y&&(b.colors[y]?f=b.colors[y]:f=y),{display:"inline-block",fill:f,color:f,height:S,width:S}}var h=(0,g.styled)("svg",c);return Z.Svg=h,h.displayName="Svg",h.displayName="Svg",Z}var V={},re;function qe(){if(re)return V;re=1,Object.defineProperty(V,"__esModule",{value:!0}),V.default=g;function g(c){var h={};for(var m in c)m[0]!=="$"&&(h[m]=c[m]);return h}return V}var ne;function je(){if(ne)return j;ne=1;function g(r){"@babel/helpers - typeof";return g=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},g(r)}Object.defineProperty(j,"__esModule",{value:!0}),j.default=void 0;var c=f(K()),h=ae(),m=Ze(),b=y(qe()),v=["children","title","size","color","overrides"];function y(r){return r&&r.__esModule?r:{default:r}}function S(r){if(typeof WeakMap!="function")return null;var a=new WeakMap,l=new WeakMap;return(S=function(e){return e?l:a})(r)}function f(r,a){if(r&&r.__esModule)return r;if(r===null||g(r)!=="object"&&typeof r!="function")return{default:r};var l=S(a);if(l&&l.has(r))return l.get(r);var n={},e=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in r)if(o!=="default"&&Object.prototype.hasOwnProperty.call(r,o)){var p=e?Object.getOwnPropertyDescriptor(r,o):null;p&&(p.get||p.set)?Object.defineProperty(n,o,p):n[o]=r[o]}return n.default=r,l&&l.set(r,n),n}function T(){return T=Object.assign?Object.assign.bind():function(r){for(var a=1;a<arguments.length;a++){var l=arguments[a];for(var n in l)Object.prototype.hasOwnProperty.call(l,n)&&(r[n]=l[n])}return r},T.apply(this,arguments)}function P(r,a){var l=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);a&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})),l.push.apply(l,n)}return l}function R(r){for(var a=1;a<arguments.length;a++){var l=arguments[a]!=null?arguments[a]:{};a%2?P(Object(l),!0).forEach(function(n){$(r,n,l[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(l)):P(Object(l)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(l,n))})}return r}function $(r,a,l){return a in r?Object.defineProperty(r,a,{value:l,enumerable:!0,configurable:!0,writable:!0}):r[a]=l,r}function _(r,a){return F(r)||M(r,a)||N(r,a)||L()}function L(){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 N(r,a){if(r){if(typeof r=="string")return x(r,a);var l=Object.prototype.toString.call(r).slice(8,-1);if(l==="Object"&&r.constructor&&(l=r.constructor.name),l==="Map"||l==="Set")return Array.from(r);if(l==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(l))return x(r,a)}}function x(r,a){(a==null||a>r.length)&&(a=r.length);for(var l=0,n=new Array(a);l<a;l++)n[l]=r[l];return n}function M(r,a){var l=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(l!=null){var n=[],e=!0,o=!1,p,d;try{for(l=l.call(r);!(e=(p=l.next()).done)&&(n.push(p.value),!(a&&n.length===a));e=!0);}catch(O){o=!0,d=O}finally{try{!e&&l.return!=null&&l.return()}finally{if(o)throw d}}return n}}function F(r){if(Array.isArray(r))return r}function i(r,a){if(r==null)return{};var l=t(r,a),n,e;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(r);for(e=0;e<o.length;e++)n=o[e],!(a.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(r,n)&&(l[n]=r[n])}return l}function t(r,a){if(r==null)return{};var l={},n=Object.keys(r),e,o;for(o=0;o<n.length;o++)e=n[o],!(a.indexOf(e)>=0)&&(l[e]=r[e]);return l}var u=function(a,l){var n=a.children,e=a.title,o=a.size,p=a.color,d=a.overrides,O=d===void 0?{}:d,I=i(a,v),w=(0,h.getOverrides)(O.Svg,m.Svg),W=_(w,2),E=W[0],B=W[1],U=E.__STYLETRON__?R(R({title:e,$color:p,$size:o},I),B):R(R({title:e,color:p,size:o},(0,b.default)(I)),(0,b.default)(B));return c.createElement(E,T({"data-baseweb":"icon",ref:l},U),e?c.createElement("title",null,e):null,n)},s=c.forwardRef(u);return j.default=s,j}var oe;function He(){if(oe)return q;oe=1;function g(t){"@babel/helpers - typeof";return g=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(u){return typeof u}:function(u){return u&&typeof Symbol=="function"&&u.constructor===Symbol&&u!==Symbol.prototype?"symbol":typeof u},g(t)}Object.defineProperty(q,"__esModule",{value:!0}),q.default=void 0;var c=f(K()),h=Y,m=ae(),b=y(je()),v=["title","size","color","overrides"];function y(t){return t&&t.__esModule?t:{default:t}}function S(t){if(typeof WeakMap!="function")return null;var u=new WeakMap,s=new WeakMap;return(S=function(a){return a?s:u})(t)}function f(t,u){if(t&&t.__esModule)return t;if(t===null||g(t)!=="object"&&typeof t!="function")return{default:t};var s=S(u);if(s&&s.has(t))return s.get(t);var r={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if(l!=="default"&&Object.prototype.hasOwnProperty.call(t,l)){var n=a?Object.getOwnPropertyDescriptor(t,l):null;n&&(n.get||n.set)?Object.defineProperty(r,l,n):r[l]=t[l]}return r.default=t,s&&s.set(t,r),r}function T(){return T=Object.assign?Object.assign.bind():function(t){for(var u=1;u<arguments.length;u++){var s=arguments[u];for(var r in s)Object.prototype.hasOwnProperty.call(s,r)&&(t[r]=s[r])}return t},T.apply(this,arguments)}function P(t,u){if(t==null)return{};var s=R(t,u),r,a;if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(t);for(a=0;a<l.length;a++)r=l[a],!(u.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(s[r]=t[r])}return s}function R(t,u){if(t==null)return{};var s={},r=Object.keys(t),a,l;for(l=0;l<r.length;l++)a=r[l],!(u.indexOf(a)>=0)&&(s[a]=t[a]);return s}function $(t,u){return M(t)||x(t,u)||L(t,u)||_()}function _(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
3
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function L(t,u){if(t){if(typeof t=="string")return N(t,u);var s=Object.prototype.toString.call(t).slice(8,-1);if(s==="Object"&&t.constructor&&(s=t.constructor.name),s==="Map"||s==="Set")return Array.from(t);if(s==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s))return N(t,u)}}function N(t,u){(u==null||u>t.length)&&(u=t.length);for(var s=0,r=new Array(u);s<u;s++)r[s]=t[s];return r}function x(t,u){var s=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(s!=null){var r=[],a=!0,l=!1,n,e;try{for(s=s.call(t);!(a=(n=s.next()).done)&&(r.push(n.value),!(u&&r.length===u));a=!0);}catch(o){l=!0,e=o}finally{try{!a&&s.return!=null&&s.return()}finally{if(l)throw e}}return r}}function M(t){if(Array.isArray(t))return t}function F(t,u){var s=(0,h.useStyletron)(),r=$(s,2),a=r[1],l=t.title,n=l===void 0?"Delete Alt":l,e=t.size,o=t.color,p=t.overrides,d=p===void 0?{}:p,O=P(t,v),I=(0,m.mergeOverride)({component:a.icons&&a.icons.DeleteAlt?a.icons.DeleteAlt:null},d&&d.Svg?(0,m.toObjectOverride)(d.Svg):{});return c.createElement(b.default,T({viewBox:"0 0 24 24",ref:u,title:n,size:e,color:o,overrides:{Svg:I}},O),c.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 20C16.4183 20 20 16.4183 20 12C20 7.58173 16.4183 4 12 4C7.58173 4 4 7.58173 4 12C4 16.4183 7.58173 20 12 20ZM10.0303 8.96967C9.73743 8.67679 9.26257 8.67679 8.96967 8.96967C8.67676 9.26257 8.67676 9.73743 8.96967 10.0303L10.9393 12L8.96967 13.9697C8.67676 14.2626 8.67676 14.7374 8.96967 15.0303C9.26257 15.3232 9.73743 15.3232 10.0303 15.0303L12 13.0607L13.9697 15.0303C14.2626 15.3232 14.7374 15.3232 15.0303 15.0303C15.3232 14.7374 15.3232 14.2626 15.0303 13.9697L13.0607 12L15.0303 10.0303C15.3232 9.73743 15.3232 9.26257 15.0303 8.96967C14.7374 8.67679 14.2626 8.67679 13.9697 8.96967L12 10.9393L10.0303 8.96967Z"}))}var i=c.forwardRef(F);return q.default=i,q}var ie;function Ve(){if(ie)return C;ie=1,Object.defineProperty(C,"__esModule",{value:!0}),C.getRootStyles=C.getInputStyles=C.getInputContainerStyles=C.StyledMaskToggleButton=C.StyledClearIconContainer=C.StyledClearIcon=C.Root=C.InputEnhancer=C.InputContainer=C.Input=void 0;var g=Y,c=Fe(),h=m(He());function m(n){return n&&n.__esModule?n:{default:n}}function b(n,e){var o=Object.keys(n);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(n);e&&(p=p.filter(function(d){return Object.getOwnPropertyDescriptor(n,d).enumerable})),o.push.apply(o,p)}return o}function v(n){for(var e=1;e<arguments.length;e++){var o=arguments[e]!=null?arguments[e]:{};e%2?b(Object(o),!0).forEach(function(p){y(n,p,o[p])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(o)):b(Object(o)).forEach(function(p){Object.defineProperty(n,p,Object.getOwnPropertyDescriptor(o,p))})}return n}function y(n,e,o){return e in n?Object.defineProperty(n,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[e]=o,n}var S=(0,g.styled)("button",function(n){var e,o=n.$theme,p=n.$size,d=n.$isFocusVisible,O=(e={},y(e,c.SIZE.mini,o.sizing.scale400),y(e,c.SIZE.compact,o.sizing.scale400),y(e,c.SIZE.default,o.sizing.scale300),y(e,c.SIZE.large,o.sizing.scale200),e)[p];return{display:"flex",alignItems:"center",borderTopStyle:"none",borderBottomStyle:"none",borderLeftStyle:"none",borderRightStyle:"none",background:"none",paddingLeft:O,paddingRight:O,outline:d?"solid 3px ".concat(o.colors.accent):"none",color:o.colors.contentPrimary}});C.StyledMaskToggleButton=S,S.displayName="StyledMaskToggleButton",S.displayName="StyledMaskToggleButton";var f=(0,g.styled)("div",function(n){var e,o=n.$alignTop,p=o===void 0?!1:o,d=n.$size,O=n.$theme,I=(e={},y(e,c.SIZE.mini,O.sizing.scale200),y(e,c.SIZE.compact,O.sizing.scale200),y(e,c.SIZE.default,O.sizing.scale100),y(e,c.SIZE.large,O.sizing.scale0),e)[d];return{display:"flex",alignItems:p?"flex-start":"center",paddingLeft:I,paddingRight:I,paddingTop:p?O.sizing.scale500:"0px",color:O.colors.contentPrimary}});C.StyledClearIconContainer=f,f.displayName="StyledClearIconContainer",f.displayName="StyledClearIconContainer";var T=(0,g.styled)(h.default,function(n){var e=n.$theme,o=n.$isFocusVisible;return{cursor:"pointer",outline:o?"solid 3px ".concat(e.colors.accent):"none"}});C.StyledClearIcon=T,T.displayName="StyledClearIcon",T.displayName="StyledClearIcon";function P(n,e){var o;return(o={},y(o,c.SIZE.mini,{paddingTop:e.scale100,paddingBottom:e.scale100,paddingLeft:e.scale550,paddingRight:e.scale550}),y(o,c.SIZE.compact,{paddingTop:e.scale200,paddingBottom:e.scale200,paddingLeft:e.scale550,paddingRight:e.scale550}),y(o,c.SIZE.default,{paddingTop:e.scale400,paddingBottom:e.scale400,paddingLeft:e.scale550,paddingRight:e.scale550}),y(o,c.SIZE.large,{paddingTop:e.scale550,paddingBottom:e.scale550,paddingLeft:e.scale550,paddingRight:e.scale550}),o)[n]}function R(n,e,o,p,d){var O=n===c.ADJOINED.both||n===c.ADJOINED.left&&p!=="rtl"||n===c.ADJOINED.right&&p==="rtl"||d&&p==="rtl",I=n===c.ADJOINED.both||n===c.ADJOINED.right&&p!=="rtl"||n===c.ADJOINED.left&&p==="rtl"||d&&p!=="rtl";return{paddingLeft:O?o.scale550:"0px",paddingRight:I?o.scale550:"0px"}}function $(n,e){var o;return(o={},y(o,c.SIZE.mini,e.font100),y(o,c.SIZE.compact,e.font200),y(o,c.SIZE.default,e.font300),y(o,c.SIZE.large,e.font400),o)[n]}function _(n,e,o){var p=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,d=arguments.length>4?arguments[4]:void 0;return n?{borderLeftColor:d.inputFillDisabled,borderRightColor:d.inputFillDisabled,borderTopColor:d.inputFillDisabled,borderBottomColor:d.inputFillDisabled,backgroundColor:d.inputFillDisabled}:e?{borderLeftColor:d.borderSelected,borderRightColor:d.borderSelected,borderTopColor:d.borderSelected,borderBottomColor:d.borderSelected,backgroundColor:d.inputFillActive}:o?{borderLeftColor:d.inputBorderError,borderRightColor:d.inputBorderError,borderTopColor:d.inputBorderError,borderBottomColor:d.inputBorderError,backgroundColor:d.inputFillError}:p?{borderLeftColor:d.inputBorderPositive,borderRightColor:d.inputBorderPositive,borderTopColor:d.inputBorderPositive,borderBottomColor:d.inputBorderPositive,backgroundColor:d.inputFillPositive}:{borderLeftColor:d.inputBorder,borderRightColor:d.inputBorder,borderTopColor:d.inputBorder,borderBottomColor:d.inputBorder,backgroundColor:d.inputFill}}function L(n,e){var o=e.inputBorderRadius;return n===c.SIZE.mini&&(o=e.inputBorderRadiusMini),{borderTopLeftRadius:o,borderBottomLeftRadius:o,borderTopRightRadius:o,borderBottomRightRadius:o}}var N=function(e){var o=e.$isFocused,p=e.$adjoined,d=e.$error,O=e.$disabled,I=e.$positive,w=e.$size,W=e.$theme,E=e.$theme,B=E.borders,U=E.colors,le=E.sizing,ue=E.typography,G=E.animation,se=e.$hasIconTrailing;return v(v(v(v({boxSizing:"border-box",display:"flex",overflow:"hidden",width:"100%",borderLeftWidth:"2px",borderRightWidth:"2px",borderTopWidth:"2px",borderBottomWidth:"2px",borderLeftStyle:"solid",borderRightStyle:"solid",borderTopStyle:"solid",borderBottomStyle:"solid",transitionProperty:"border",transitionDuration:G.timing200,transitionTimingFunction:G.easeOutCurve},L(w,B)),$(w,ue)),_(O,o,d,I,U)),R(p,w,le,W.direction,se))};C.getRootStyles=N;var x=(0,g.styled)("div",N);C.Root=x,x.displayName="Root",x.displayName="Root";function M(n,e){var o;return(o={},y(o,c.SIZE.mini,{paddingRight:e.scale400,paddingLeft:e.scale400}),y(o,c.SIZE.compact,{paddingRight:e.scale400,paddingLeft:e.scale400}),y(o,c.SIZE.default,{paddingRight:e.scale300,paddingLeft:e.scale300}),y(o,c.SIZE.large,{paddingRight:e.scale200,paddingLeft:e.scale200}),o)[n]}function F(n,e,o,p,d){return n?{color:d.inputEnhancerTextDisabled,backgroundColor:d.inputFillDisabled}:e?{color:d.contentPrimary,backgroundColor:d.inputFillActive}:o?{color:d.contentPrimary,backgroundColor:d.inputFillError}:p?{color:d.contentPrimary,backgroundColor:d.inputFillPositive}:{color:d.contentPrimary,backgroundColor:d.inputFill}}var i=(0,g.styled)("div",function(n){var e=n.$size,o=n.$disabled,p=n.$isFocused,d=n.$error,O=n.$positive,I=n.$theme,w=I.colors,W=I.sizing,E=I.typography,B=I.animation;return v(v(v({display:"flex",alignItems:"center",justifyContent:"center",transitionProperty:"color, background-color",transitionDuration:B.timing200,transitionTimingFunction:B.easeOutCurve},$(e,E)),M(e,W)),F(o,p,d,O,w))});C.InputEnhancer=i,i.displayName="InputEnhancer",i.displayName="InputEnhancer";function t(n,e,o,p,d){return n?{color:d.inputTextDisabled,backgroundColor:d.inputFillDisabled}:e?{color:d.contentPrimary,backgroundColor:d.inputFillActive}:o?{color:d.contentPrimary,backgroundColor:d.inputFillError}:p?{color:d.contentPrimary,backgroundColor:d.inputFillPositive}:{color:d.contentPrimary,backgroundColor:d.inputFill}}var u=function(e){var o=e.$isFocused,p=e.$error,d=e.$disabled,O=e.$positive,I=e.$size,w=e.$theme,W=w.colors,E=w.typography,B=w.animation;return v(v({display:"flex",width:"100%",transitionProperty:"background-color",transitionDuration:B.timing200,transitionTimingFunction:B.easeOutCurve},$(I,E)),t(d,o,p,O,W))};C.getInputContainerStyles=u;var s=(0,g.styled)("div",u);C.InputContainer=s,s.displayName="InputContainer",s.displayName="InputContainer";function r(n,e,o,p){return n?{color:p.inputTextDisabled,"-webkit-text-fill-color":p.inputTextDisabled,caretColor:p.contentPrimary,"::placeholder":{color:p.inputPlaceholderDisabled}}:{color:p.contentPrimary,caretColor:p.contentPrimary,"::placeholder":{color:p.inputPlaceholder}}}var a=function(e){var o=e.$disabled,p=e.$isFocused,d=e.$error,O=e.$size,I=e.$theme,w=I.colors,W=I.sizing,E=I.typography;return v(v(v({boxSizing:"border-box",backgroundColor:"transparent",borderLeftWidth:0,borderRightWidth:0,borderTopWidth:0,borderBottomWidth:0,borderLeftStyle:"none",borderRightStyle:"none",borderTopStyle:"none",borderBottomStyle:"none",outline:"none",width:"100%",minWidth:0,maxWidth:"100%",cursor:o?"not-allowed":"text",margin:"0",paddingTop:"0",paddingBottom:"0",paddingLeft:"0",paddingRight:"0"},$(O,E)),P(O,W)),r(o,p,d,w))};C.getInputStyles=a;var l=(0,g.styled)("input",a);return C.Input=l,l.displayName="Input",l.displayName="Input",C}var ke=Ve();function Ue({disabled:g,element:c,widgetMgr:h,fragmentId:m}){const[b,v]=Ae({getStateFromWidgetMgr:Je,getDefaultStateFromProto:Ke,getCurrStateFromProto:Ye,updateWidgetMgrState:Ge,element:c,widgetMgr:h,fragmentId:m}),y=k.useContext(Ie),S=J(c.default)&&!g,f=Pe(),T={Select:{props:{disabled:g,overrides:{ControlContainer:{style:({$isFocused:$})=>{const _=xe(f.colors,$);return{height:f.sizes.minElementHeight,borderLeftWidth:f.sizes.borderWidth,borderRightWidth:f.sizes.borderWidth,borderTopWidth:f.sizes.borderWidth,borderBottomWidth:f.sizes.borderWidth,borderTopColor:_,borderRightColor:_,borderBottomColor:_,borderLeftColor:_}}},IconsContainer:{style:()=>({paddingRight:f.spacing.sm})},ValueContainer:{style:()=>({lineHeight:f.lineHeights.inputWidget,paddingRight:f.spacing.sm,paddingLeft:f.spacing.md,paddingBottom:f.spacing.sm,paddingTop:f.spacing.sm})},SingleValue:{style:{fontWeight:f.fontWeights.normal},props:{"data-testid":"stTimeInputTimeDisplay"}},Dropdown:{style:()=>({paddingTop:f.spacing.none,paddingBottom:f.spacing.none,boxShadow:"none",maxHeight:f.sizes.maxDropdownHeight})},DropdownListItem:{component:We},Popover:{props:{ignoreBoundary:y,overrides:{Body:{style:()=>({marginTop:f.spacing.px})}}}},Placeholder:{style:()=>({color:f.colors.fadedText60})},SelectArrow:{component:De,props:{overrides:{Svg:{style:()=>({width:f.iconSizes.xl,height:f.iconSizes.xl})}}}}}}}},P=k.useCallback($=>{const _=$===null?null:Xe($);v({value:_,fromUi:!0})},[v]),R=k.useCallback(()=>{P(null)},[P]);return $e("div",{className:"stTimeInput","data-testid":"stTimeInput",children:[z(we,{label:c.label,disabled:g,labelVisibility:_e(c.labelVisibility?.value),children:c.help&&z(Te,{children:z(Ee,{content:c.help,placement:Re.TOP_RIGHT})})}),z(Ne,{format:"24",step:c.step?Number(c.step):900,value:J(b)?void 0:Qe(b),onChange:P,overrides:T,nullable:S,creatable:!0,"aria-label":c.label}),S&&!J(b)&&z(Be,{onClick:R,"data-testid":"stTimeInputClearButton",children:z(ke.StyledClearIcon,{overrides:{Svg:{style:{color:f.colors.grayTextColor,padding:f.spacing.threeXS,height:f.sizes.clearIconSize,width:f.sizes.clearIconSize,":hover":{fill:f.colors.bodyText}}}},$isFocusVisible:!1})})]})}function Je(g,c){return g.getStringValue(c)??null}function Ke(g){return g.default??null}function Ye(g){return g.value??null}function Ge(g,c,h,m){c.setStringValue(g,h.value,{fromUi:h.fromUi},m)}function Xe(g){const c=g.getHours().toString().padStart(2,"0"),h=g.getMinutes().toString().padStart(2,"0");return`${c}:${h}`}function Qe(g){if(g===null)return null;const[c,h]=g.split(":").map(Number),m=new Date;return m.setHours(c),m.setMinutes(h),m}const lt=k.memo(Ue);export{lt as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r,E as q,_ as M,x as E,b7 as T,e as h,n as Q,Q as de,g as pe,f as fe,aa as me,aI as _,l as W,j as u,m as be,ab as ge,T as he,P as ye,ac as Ie,ad as Te,Z as Ce,ax as X}from"./index.DMxc2XFp.js";import{I as we}from"./InputInstructions.Cj5-1zf6.js";import{u as Se}from"./FormClearHelper.CG2XN1_g.js";import{s as ve}from"./sprintf.D7DtBTRn.js";import{u as Ve}from"./uniqueId.CtqIr-Yh.js";import{I as xe}from"./input.D5oh9-aB.js";import"./base-input.o9tL8MDP.js";var Z=r.forwardRef(function(e,t){var a={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(q,M({iconAttrs:a,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},e,{ref:t}),r.createElement("path",{d:"M0 3v2h8V3H0z"}))});Z.displayName="Minus";var J=r.forwardRef(function(e,t){var a={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(q,M({iconAttrs:a,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},e,{ref:t}),r.createElement("path",{d:"M3 0v3H0v2h3v3h2V5h3V3H5V0H3z"}))});J.displayName="Plus";const ke=E("div",{target:"eaba2yi0"})(({theme:e})=>({display:"flex",flexDirection:"row",flexWrap:"nowrap",alignItems:"center",height:e.sizes.minElementHeight,borderWidth:e.sizes.borderWidth,borderStyle:"solid",borderColor:e.colors.widgetBorderColor??e.colors.secondaryBg,transitionDuration:"200ms",transitionProperty:"border",transitionTimingFunction:"cubic-bezier(0.2, 0.8, 0.4, 1)",borderRadius:e.radii.default,overflow:"hidden","&.focused":{borderColor:e.colors.primary},input:{MozAppearance:"textfield","&::-webkit-inner-spin-button, &::-webkit-outer-spin-button":{WebkitAppearance:"none",margin:e.spacing.none}}})),De=E("div",{target:"eaba2yi1"})({display:"flex",flexDirection:"row",alignSelf:"stretch"}),G=E("button",{target:"eaba2yi2"})(({theme:e})=>({margin:e.spacing.none,border:"none",height:e.sizes.full,display:"flex",alignItems:"center",width:e.sizes.numberInputControlsWidth,justifyContent:"center",color:e.colors.bodyText,transition:"color 300ms, backgroundColor 300ms",backgroundColor:e.colors.secondaryBg,"&:hover:enabled, &:focus:enabled":{color:e.colors.white,backgroundColor:e.colors.primary,transition:"none",outline:"none"},"&:active":{outline:"none",border:"none"},"&:disabled":{cursor:"not-allowed",color:e.colors.fadedText40}})),Ee=E("div",{target:"eaba2yi3"})(({theme:e,clearable:t})=>({position:"absolute",marginRight:e.spacing.twoXS,left:0,right:`calc(${e.sizes.numberInputControlsWidth} * 2 + ${t?"1em":"0em"})`})),Re=de.getLogger("NumberInput");function Ne(e){return h(e)||e===""?void 0:e}const D=({value:e,format:t,step:a,dataType:m})=>{if(h(e))return null;let o=Ne(t);if(h(o)&&Q(a)){const i=a.toString();m===T.DataType.FLOAT&&a!==0&&i.includes(".")&&(o=`%0.${i.split(".")[1].length}f`)}if(h(o))return e.toString();try{return ve.sprintf(o,e)}catch(i){return Re.warn(`Error in sprintf(${o}, ${e}): ${i}`),String(e)}},Fe=(e,t,a)=>h(e)?!1:e-t>=a,ze=(e,t,a)=>h(e)?!1:e+t<=a,We=e=>(e.element.dataType===T.DataType.INT?e.widgetMgr.getIntValue(e.element):e.widgetMgr.getDoubleValue(e.element))??e.element.default??null,K=({step:e,dataType:t})=>e||(t===T.DataType.INT?1:.01),Le=({disabled:e,element:t,widgetMgr:a,fragmentId:m})=>{const o=pe(),{dataType:i,id:v,formId:f,default:L,format:b,icon:R,min:y,max:I}=t,{width:B,elementRef:Y}=fe(),[s,ee]=r.useState(()=>K(t)),P=We({element:t,widgetMgr:a}),[g,C]=r.useState(!1),[l,w]=r.useState(P),[U,H]=r.useState(!1),V=r.useRef(null),A=r.useRef(Ve("number_input_")),[$,S]=r.useState(()=>D({value:P,dataType:i,format:b,step:s})),x=Fe(l,s,y),k=ze(l,s,I),O=me({formId:f}),te=O?a.allowFormEnterToSubmit(f):g,oe=U&&B>o.breakpoints.hideWidgetDetails;r.useEffect(()=>{ee(K({step:t.step,dataType:t.dataType}))},[t.dataType,t.step]),r.useEffect(()=>{g||S(D({value:l,dataType:i,format:b,step:s}))},[i,b,s]);const d=r.useCallback(({value:n,source:c})=>{if(Q(n)&&(y>n||n>I))V.current?.reportValidity();else{const p=n??L??null;switch(i){case T.DataType.INT:a.setIntValue({id:v,formId:f},p,c,m);break;case T.DataType.FLOAT:a.setDoubleValue({id:v,formId:f},p,c,m);break;default:throw new Error("Invalid data type")}C(!1),w(p),S(D({value:p,dataType:i,format:b,step:s}))}},[y,I,V,a,m,s,i,v,f,L,b]),re=r.useCallback(()=>{g&&d({value:l,source:{fromUi:!0}}),H(!1)},[g,l,d]),ne=r.useCallback(()=>{H(!0)},[]),j=r.useCallback(()=>{const{value:n}=t;t.setValue=!1,w(n??null),S(D({value:n??null,dataType:i,format:b,step:s})),d({value:n??null,source:{fromUi:!1}})},[t,s,d,i,b]);r.useEffect(()=>{t.setValue?j():d({value:l,source:{fromUi:!1}});const n=V.current;if(n){const c=p=>{p.preventDefault()};return n.addEventListener("wheel",c),()=>{n.removeEventListener("wheel",c)}}},[]),t.setValue&&j();const N=h(t.default)&&!e,ae=r.useCallback(()=>{const n=t.default??null;w(n),d({value:n,source:{fromUi:!0}})},[t]);Se({element:t,widgetMgr:a,onFormCleared:ae});const se=n=>{const{value:c}=n.target;if(c==="")C(!0),w(null),S(null);else{let p;t.dataType===T.DataType.INT?p=parseInt(c,10):p=parseFloat(c),C(!0),w(p),S(c)}},F=r.useCallback(()=>{k&&(C(!0),d({value:(l??y)+s,source:{fromUi:!0}}))},[l,y,s,k]),z=r.useCallback(()=>{x&&(C(!0),d({value:(l??I)-s,source:{fromUi:!0}}))},[l,I,s,x]),ie=r.useCallback(n=>{const{key:c}=n;switch(c){case"ArrowUp":n.preventDefault(),F();break;case"ArrowDown":n.preventDefault(),z();break}},[F,z]),le=r.useCallback(n=>{n.key==="Enter"&&(g&&d({value:l,source:{fromUi:!0}}),a.allowFormEnterToSubmit(f)&&a.submitForm(f,m))},[g,l,d,a,f,m]),ce=_(o.iconSizes.lg)+2*_(o.spacing.twoXS),ue=R?o.breakpoints.hideNumberInputControls+ce:o.breakpoints.hideNumberInputControls;return W("div",{className:"stNumberInput","data-testid":"stNumberInput",ref:Y,children:[u(Ie,{label:t.label,disabled:e,labelVisibility:be(t.labelVisibility?.value),htmlFor:A.current,children:t.help&&u(ge,{children:u(he,{content:t.help,placement:ye.TOP_RIGHT})})}),W(ke,{className:U?"focused":"","data-testid":"stNumberInputContainer",children:[u(xe,{type:"number",inputRef:V,value:$??"",placeholder:t.placeholder,onBlur:re,onFocus:ne,onChange:se,onKeyPress:le,onKeyDown:ie,clearable:N,clearOnEscape:N,disabled:e,"aria-label":t.label,startEnhancer:t.icon&&u(Ce,{"data-testid":"stNumberInputIcon",iconValue:t.icon,size:"lg"}),id:A.current,overrides:{ClearIconContainer:{style:{padding:0}},ClearIcon:{props:{overrides:{Svg:{style:{color:o.colors.grayTextColor,padding:o.spacing.threeXS,height:o.sizes.clearIconSize,width:o.sizes.clearIconSize,":hover":{fill:o.colors.bodyText}}}}}},Input:{props:{"data-testid":"stNumberInputField",step:s,min:y,max:I,type:"number",inputMode:""},style:{fontWeight:o.fontWeights.normal,lineHeight:o.lineHeights.inputWidget,paddingRight:o.spacing.sm,paddingLeft:o.spacing.md,paddingBottom:o.spacing.sm,paddingTop:o.spacing.sm,"::placeholder":{color:o.colors.fadedText60}}},InputContainer:{style:()=>({borderTopRightRadius:0,borderBottomRightRadius:0})},Root:{style:{borderTopRightRadius:0,borderBottomRightRadius:0,borderTopLeftRadius:0,borderBottomLeftRadius:0,borderLeftWidth:0,borderRightWidth:0,borderTopWidth:0,borderBottomWidth:0,paddingRight:0,paddingLeft:R?o.spacing.sm:0}},StartEnhancer:{style:{paddingLeft:0,paddingRight:0,minWidth:o.iconSizes.lg,color:Te(R)?o.colors.fadedText60:"inherit"}}}}),B>ue&&W(De,{children:[u(G,{"data-testid":"stNumberInputStepDown",onClick:z,disabled:!x||e,tabIndex:-1,children:u(X,{content:Z,size:"xs",color:x?"inherit":o.colors.fadedText40})}),u(G,{"data-testid":"stNumberInputStepUp",onClick:F,disabled:!k||e,tabIndex:-1,children:u(X,{content:J,size:"xs",color:k?"inherit":o.colors.fadedText40})})]})]}),oe&&u(Ee,{clearable:N,children:u(we,{dirty:g,value:$??"",inForm:O,allowEnterToSubmit:te})})]})},je=r.memo(Le);export{je as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{aN as M,aO as W,aP as I,aQ as L,x as O,r as n,g as V,az as H,aR as P,l as A,j as g,m as B,ab as E,T as N,P as $,ac as F,aS as k,aT as D,av as U,aU as j,ae as Y}from"./index.DMxc2XFp.js";import{u as _}from"./useBasicWidgetState.Bfp6TnSw.js";import{a as G}from"./_arrayIncludes.B19Iyn2B.js";import"./FormClearHelper.CG2XN1_g.js";import"./_baseIndexOf.BTknn6Gb.js";var K=200;function Q(o,t,d,p){var e=-1,h=G,s=!0,u=o.length,a=[],f=t.length;if(!u)return a;t.length>=K&&(h=W,s=!1,t=new M(t));e:for(;++e<u;){var i=o[e],c=i;if(i=i!==0?i:0,s&&c===c){for(var m=f;m--;)if(t[m]===c)continue e;a.push(i)}else h(t,c,p)||a.push(i)}return a}var X=I(function(o,t){return L(o)?Q(o,t):[]});const Z=O("div",{target:"euzcfsp0"})(({theme:o})=>({"span[aria-disabled='true']":{background:o.colors.fadedText05}})),q=(o,t)=>o.getStringArrayValue(t),J=o=>o.default.map(t=>o.options[t])??null,ee=o=>o.rawValues??null,te=(o,t,d,p)=>{t.setStringArrayValue(o,d.value,{fromUi:d.fromUi},p)},oe=o=>{const{element:t,widgetMgr:d,fragmentId:p}=o,e=V(),h=n.useContext(H),[s,u]=_({getStateFromWidgetMgr:q,getDefaultStateFromProto:J,getCurrStateFromProto:ee,updateWidgetMgrState:te,element:t,widgetMgr:d,fragmentId:p}),a=t.maxSelections>0&&s.length>=t.maxSelections,f=n.useMemo(()=>{if(t.maxSelections===0)return"No results";if(s.length===t.maxSelections){const r=t.maxSelections!==1?"options":"option";return`You can only select up to ${t.maxSelections} ${r}. Remove an option first.`}return"No results"},[t.maxSelections,s.length]),i=n.useCallback(r=>{switch(r.type){case"remove":return X(s,r.option?.value);case"clear":return[];case"select":return s.concat([r.option?.value]);default:throw new Error(`State transition is unknown: ${r.type}`)}},[s]),c=n.useCallback(r=>{t.maxSelections&&r.type==="select"&&s.length>=t.maxSelections||u({value:i(r),fromUi:!0})},[t.maxSelections,i,u,s.length]),{options:m}=t,{placeholder:y,disabled:v,selectOptions:C,inputReadOnly:z,valuesToUiMulti:b,createFilterOptions:x}=P({options:m,isMulti:!0,acceptNewOptions:t.acceptNewOptions??!1,placeholderInput:t.placeholder}),R=n.useCallback((r,l)=>a?[]:x(s)(r,l),[x,a,s]),S=o.disabled||v,w=n.useMemo(()=>b(s),[b,s]),T=n.useMemo(()=>{const r=e.fontSizes.baseFontSize*1.6+14;return`${Math.round(r*4.25)}px`},[e.fontSizes.baseFontSize]);return A("div",{className:"stMultiSelect","data-testid":"stMultiSelect",children:[g(F,{label:t.label,disabled:S,labelVisibility:B(t.labelVisibility?.value),children:t.help&&g(E,{children:g(N,{content:t.help,placement:$.TOP_RIGHT})})}),g(Z,{children:g(k,{creatable:t.acceptNewOptions??!1,options:C,labelKey:"label",valueKey:"value","aria-label":t.label,placeholder:y,type:j.select,multi:!0,onChange:c,value:w,disabled:S,size:"compact",noResultsMsg:f,filterOptions:R,closeOnSelect:!1,ignoreCase:!1,overrides:{Popover:{props:{ignoreBoundary:h,overrides:{Body:{style:()=>({marginTop:e.spacing.px})}}}},SelectArrow:{component:U,props:{style:{cursor:"pointer"},overrides:{Svg:{style:()=>({width:e.iconSizes.xl,height:e.iconSizes.xl})}}}},IconsContainer:{style:()=>({paddingRight:e.spacing.sm})},ControlContainer:{style:({$isFocused:r})=>{const l=Y(e.colors,r);return{maxHeight:T,minHeight:e.sizes.minElementHeight,borderLeftWidth:e.sizes.borderWidth,borderRightWidth:e.sizes.borderWidth,borderTopWidth:e.sizes.borderWidth,borderBottomWidth:e.sizes.borderWidth,borderTopColor:l,borderRightColor:l,borderBottomColor:l,borderLeftColor:l}}},Placeholder:{style:()=>({flex:"inherit",color:S?e.colors.fadedText40:e.colors.fadedText60})},ValueContainer:{style:()=>({overflowY:"auto",paddingLeft:e.spacing.sm,paddingTop:e.spacing.none,paddingBottom:e.spacing.none,paddingRight:e.spacing.none})},ClearIcon:{props:{overrides:{Svg:{style:{color:e.colors.grayTextColor,padding:e.spacing.threeXS,height:e.sizes.clearIconSize,width:e.sizes.clearIconSize,cursor:"pointer",":hover":{fill:e.colors.bodyText}}}}}},SearchIcon:{style:{color:e.colors.grayTextColor}},Tag:{props:{overrides:{Root:{style:{fontWeight:e.fontWeights.normal,borderTopLeftRadius:e.radii.md,borderTopRightRadius:e.radii.md,borderBottomRightRadius:e.radii.md,borderBottomLeftRadius:e.radii.md,fontSize:e.fontSizes.md,paddingLeft:e.spacing.sm,marginLeft:e.spacing.none,marginRight:e.spacing.sm,height:`calc(${e.sizes.minElementHeight} - 2 * ${e.spacing.xs})`,maxWidth:`calc(100% - ${e.spacing.lg})`,cursor:"default !important"}},Action:{style:{paddingLeft:0}},ActionIcon:{props:{overrides:{Svg:{style:{width:"0.625em",height:"0.625em"}}}}}}}},MultiValue:{props:{overrides:{Root:{style:{fontSize:e.fontSizes.sm}}}}},Input:{props:{readOnly:z}},Dropdown:{component:D}}})})]})},le=n.memo(oe);export{le as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{x as qt,r as x,j as te}from"./index.DMxc2XFp.js";const{entries:gt,setPrototypeOf:ft,isFrozen:Kt,getPrototypeOf:Zt,getOwnPropertyDescriptor:Jt}=Object;let{freeze:R,seal:L,create:ht}=Object,{apply:ke,construct:Ue}=typeof Reflect<"u"&&Reflect;R||(R=function(n){return n});L||(L=function(n){return n});ke||(ke=function(n,s,a){return n.apply(s,a)});Ue||(Ue=function(n,s){return new n(...s)});const me=y(Array.prototype.forEach),Qt=y(Array.prototype.lastIndexOf),ut=y(Array.prototype.pop),K=y(Array.prototype.push),en=y(Array.prototype.splice),Te=y(String.prototype.toLowerCase),Ce=y(String.prototype.toString),mt=y(String.prototype.match),Z=y(String.prototype.replace),tn=y(String.prototype.indexOf),nn=y(String.prototype.trim),b=y(Object.prototype.hasOwnProperty),S=y(RegExp.prototype.test),J=on(TypeError);function y(o){return function(n){n instanceof RegExp&&(n.lastIndex=0);for(var s=arguments.length,a=new Array(s>1?s-1:0),T=1;T<s;T++)a[T-1]=arguments[T];return ke(o,n,a)}}function on(o){return function(){for(var n=arguments.length,s=new Array(n),a=0;a<n;a++)s[a]=arguments[a];return Ue(o,s)}}function l(o,n){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Te;ft&&ft(o,null);let a=n.length;for(;a--;){let T=n[a];if(typeof T=="string"){const A=s(T);A!==T&&(Kt(n)||(n[a]=A),T=A)}o[T]=!0}return o}function rn(o){for(let n=0;n<o.length;n++)b(o,n)||(o[n]=null);return o}function w(o){const n=ht(null);for(const[s,a]of gt(o))b(o,s)&&(Array.isArray(a)?n[s]=rn(a):a&&typeof a=="object"&&a.constructor===Object?n[s]=w(a):n[s]=a);return n}function Q(o,n){for(;o!==null;){const a=Jt(o,n);if(a){if(a.get)return y(a.get);if(typeof a.value=="function")return y(a.value)}o=Zt(o)}function s(){return null}return s}const pt=R(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),we=R(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),xe=R(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),an=R(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Pe=R(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),sn=R(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Tt=R(["#text"]),dt=R(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),ve=R(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),_t=R(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),pe=R(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),ln=L(/\{\{[\w\W]*|[\w\W]*\}\}/gm),cn=L(/<%[\w\W]*|[\w\W]*%>/gm),fn=L(/\$\{[\w\W]*/gm),un=L(/^data-[\-\w.\u00B7-\uFFFF]+$/),mn=L(/^aria-[\-\w]+$/),St=L(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),pn=L(/^(?:\w+script|data):/i),Tn=L(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Rt=L(/^html$/i),dn=L(/^[a-z][.\w]*(-[.\w]+)+$/i);var Et=Object.freeze({__proto__:null,ARIA_ATTR:mn,ATTR_WHITESPACE:Tn,CUSTOM_ELEMENT:dn,DATA_ATTR:un,DOCTYPE_NAME:Rt,ERB_EXPR:cn,IS_ALLOWED_URI:St,IS_SCRIPT_OR_DATA:pn,MUSTACHE_EXPR:ln,TMPLIT_EXPR:fn});const ee={element:1,text:3,progressingInstruction:7,comment:8,document:9},_n=function(){return typeof window>"u"?null:window},En=function(n,s){if(typeof n!="object"||typeof n.createPolicy!="function")return null;let a=null;const T="data-tt-policy-suffix";s&&s.hasAttribute(T)&&(a=s.getAttribute(T));const A="dompurify"+(a?"#"+a:"");try{return n.createPolicy(A,{createHTML(I){return I},createScriptURL(I){return I}})}catch{return console.warn("TrustedTypes policy "+A+" could not be created."),null}},At=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function yt(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:_n();const n=r=>yt(r);if(n.version="3.2.6",n.removed=[],!o||!o.document||o.document.nodeType!==ee.document||!o.Element)return n.isSupported=!1,n;let{document:s}=o;const a=s,T=a.currentScript,{DocumentFragment:A,HTMLTemplateElement:I,Node:G,Element:ne,NodeFilter:B,NamedNodeMap:bt=o.NamedNodeMap||o.MozNamedAttrMap,HTMLFormElement:It,DOMParser:Dt,trustedTypes:oe}=o,Y=ne.prototype,Nt=Q(Y,"cloneNode"),Mt=Q(Y,"remove"),Ct=Q(Y,"nextSibling"),wt=Q(Y,"childNodes"),ie=Q(Y,"parentNode");if(typeof I=="function"){const r=s.createElement("template");r.content&&r.content.ownerDocument&&(s=r.content.ownerDocument)}let g,X="";const{implementation:_e,createNodeIterator:xt,createDocumentFragment:Pt,getElementsByTagName:vt}=s,{importNode:kt}=a;let h=At();n.isSupported=typeof gt=="function"&&typeof ie=="function"&&_e&&_e.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Ee,ERB_EXPR:Ae,TMPLIT_EXPR:ge,DATA_ATTR:Ut,ARIA_ATTR:Ht,IS_SCRIPT_OR_DATA:Ft,ATTR_WHITESPACE:Fe,CUSTOM_ELEMENT:zt}=Et;let{IS_ALLOWED_URI:ze}=Et,m=null;const We=l({},[...pt,...we,...xe,...Pe,...Tt]);let d=null;const Ge=l({},[...dt,...ve,..._t,...pe]);let f=Object.seal(ht(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),j=null,he=null,Be=!0,Se=!0,Ye=!1,Xe=!0,v=!1,re=!0,P=!1,Re=!1,ye=!1,k=!1,ae=!1,se=!1,je=!0,Ve=!1;const Wt="user-content-";let Oe=!0,V=!1,U={},H=null;const $e=l({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let qe=null;const Ke=l({},["audio","video","img","source","image","track"]);let Le=null;const Ze=l({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),le="http://www.w3.org/1998/Math/MathML",ce="http://www.w3.org/2000/svg",N="http://www.w3.org/1999/xhtml";let F=N,be=!1,Ie=null;const Gt=l({},[le,ce,N],Ce);let fe=l({},["mi","mo","mn","ms","mtext"]),ue=l({},["annotation-xml"]);const Bt=l({},["title","style","font","a","script"]);let $=null;const Yt=["application/xhtml+xml","text/html"],Xt="text/html";let p=null,z=null;const jt=s.createElement("form"),Je=function(e){return e instanceof RegExp||e instanceof Function},De=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(z&&z===e)){if((!e||typeof e!="object")&&(e={}),e=w(e),$=Yt.indexOf(e.PARSER_MEDIA_TYPE)===-1?Xt:e.PARSER_MEDIA_TYPE,p=$==="application/xhtml+xml"?Ce:Te,m=b(e,"ALLOWED_TAGS")?l({},e.ALLOWED_TAGS,p):We,d=b(e,"ALLOWED_ATTR")?l({},e.ALLOWED_ATTR,p):Ge,Ie=b(e,"ALLOWED_NAMESPACES")?l({},e.ALLOWED_NAMESPACES,Ce):Gt,Le=b(e,"ADD_URI_SAFE_ATTR")?l(w(Ze),e.ADD_URI_SAFE_ATTR,p):Ze,qe=b(e,"ADD_DATA_URI_TAGS")?l(w(Ke),e.ADD_DATA_URI_TAGS,p):Ke,H=b(e,"FORBID_CONTENTS")?l({},e.FORBID_CONTENTS,p):$e,j=b(e,"FORBID_TAGS")?l({},e.FORBID_TAGS,p):w({}),he=b(e,"FORBID_ATTR")?l({},e.FORBID_ATTR,p):w({}),U=b(e,"USE_PROFILES")?e.USE_PROFILES:!1,Be=e.ALLOW_ARIA_ATTR!==!1,Se=e.ALLOW_DATA_ATTR!==!1,Ye=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Xe=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,v=e.SAFE_FOR_TEMPLATES||!1,re=e.SAFE_FOR_XML!==!1,P=e.WHOLE_DOCUMENT||!1,k=e.RETURN_DOM||!1,ae=e.RETURN_DOM_FRAGMENT||!1,se=e.RETURN_TRUSTED_TYPE||!1,ye=e.FORCE_BODY||!1,je=e.SANITIZE_DOM!==!1,Ve=e.SANITIZE_NAMED_PROPS||!1,Oe=e.KEEP_CONTENT!==!1,V=e.IN_PLACE||!1,ze=e.ALLOWED_URI_REGEXP||St,F=e.NAMESPACE||N,fe=e.MATHML_TEXT_INTEGRATION_POINTS||fe,ue=e.HTML_INTEGRATION_POINTS||ue,f=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&Je(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(f.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&Je(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(f.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(f.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),v&&(Se=!1),ae&&(k=!0),U&&(m=l({},Tt),d=[],U.html===!0&&(l(m,pt),l(d,dt)),U.svg===!0&&(l(m,we),l(d,ve),l(d,pe)),U.svgFilters===!0&&(l(m,xe),l(d,ve),l(d,pe)),U.mathMl===!0&&(l(m,Pe),l(d,_t),l(d,pe))),e.ADD_TAGS&&(m===We&&(m=w(m)),l(m,e.ADD_TAGS,p)),e.ADD_ATTR&&(d===Ge&&(d=w(d)),l(d,e.ADD_ATTR,p)),e.ADD_URI_SAFE_ATTR&&l(Le,e.ADD_URI_SAFE_ATTR,p),e.FORBID_CONTENTS&&(H===$e&&(H=w(H)),l(H,e.FORBID_CONTENTS,p)),Oe&&(m["#text"]=!0),P&&l(m,["html","head","body"]),m.table&&(l(m,["tbody"]),delete j.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!="function")throw J('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw J('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');g=e.TRUSTED_TYPES_POLICY,X=g.createHTML("")}else g===void 0&&(g=En(oe,T)),g!==null&&typeof X=="string"&&(X=g.createHTML(""));R&&R(e),z=e}},Qe=l({},[...we,...xe,...an]),et=l({},[...Pe,...sn]),Vt=function(e){let t=ie(e);(!t||!t.tagName)&&(t={namespaceURI:F,tagName:"template"});const i=Te(e.tagName),c=Te(t.tagName);return Ie[e.namespaceURI]?e.namespaceURI===ce?t.namespaceURI===N?i==="svg":t.namespaceURI===le?i==="svg"&&(c==="annotation-xml"||fe[c]):!!Qe[i]:e.namespaceURI===le?t.namespaceURI===N?i==="math":t.namespaceURI===ce?i==="math"&&ue[c]:!!et[i]:e.namespaceURI===N?t.namespaceURI===ce&&!ue[c]||t.namespaceURI===le&&!fe[c]?!1:!et[i]&&(Bt[i]||!Qe[i]):!!($==="application/xhtml+xml"&&Ie[e.namespaceURI]):!1},D=function(e){K(n.removed,{element:e});try{ie(e).removeChild(e)}catch{Mt(e)}},W=function(e,t){try{K(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch{K(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),e==="is")if(k||ae)try{D(t)}catch{}else try{t.setAttribute(e,"")}catch{}},tt=function(e){let t=null,i=null;if(ye)e="<remove></remove>"+e;else{const u=mt(e,/^[\r\n\t ]+/);i=u&&u[0]}$==="application/xhtml+xml"&&F===N&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const c=g?g.createHTML(e):e;if(F===N)try{t=new Dt().parseFromString(c,$)}catch{}if(!t||!t.documentElement){t=_e.createDocument(F,"template",null);try{t.documentElement.innerHTML=be?X:c}catch{}}const _=t.body||t.documentElement;return e&&i&&_.insertBefore(s.createTextNode(i),_.childNodes[0]||null),F===N?vt.call(t,P?"html":"body")[0]:P?t.documentElement:_},nt=function(e){return xt.call(e.ownerDocument||e,e,B.SHOW_ELEMENT|B.SHOW_COMMENT|B.SHOW_TEXT|B.SHOW_PROCESSING_INSTRUCTION|B.SHOW_CDATA_SECTION,null)},Ne=function(e){return e instanceof It&&(typeof e.nodeName!="string"||typeof e.textContent!="string"||typeof e.removeChild!="function"||!(e.attributes instanceof bt)||typeof e.removeAttribute!="function"||typeof e.setAttribute!="function"||typeof e.namespaceURI!="string"||typeof e.insertBefore!="function"||typeof e.hasChildNodes!="function")},ot=function(e){return typeof G=="function"&&e instanceof G};function M(r,e,t){me(r,i=>{i.call(n,e,t,z)})}const it=function(e){let t=null;if(M(h.beforeSanitizeElements,e,null),Ne(e))return D(e),!0;const i=p(e.nodeName);if(M(h.uponSanitizeElement,e,{tagName:i,allowedTags:m}),re&&e.hasChildNodes()&&!ot(e.firstElementChild)&&S(/<[/\w!]/g,e.innerHTML)&&S(/<[/\w!]/g,e.textContent)||e.nodeType===ee.progressingInstruction||re&&e.nodeType===ee.comment&&S(/<[/\w]/g,e.data))return D(e),!0;if(!m[i]||j[i]){if(!j[i]&&at(i)&&(f.tagNameCheck instanceof RegExp&&S(f.tagNameCheck,i)||f.tagNameCheck instanceof Function&&f.tagNameCheck(i)))return!1;if(Oe&&!H[i]){const c=ie(e)||e.parentNode,_=wt(e)||e.childNodes;if(_&&c){const u=_.length;for(let O=u-1;O>=0;--O){const C=Nt(_[O],!0);C.__removalCount=(e.__removalCount||0)+1,c.insertBefore(C,Ct(e))}}}return D(e),!0}return e instanceof ne&&!Vt(e)||(i==="noscript"||i==="noembed"||i==="noframes")&&S(/<\/no(script|embed|frames)/i,e.innerHTML)?(D(e),!0):(v&&e.nodeType===ee.text&&(t=e.textContent,me([Ee,Ae,ge],c=>{t=Z(t,c," ")}),e.textContent!==t&&(K(n.removed,{element:e.cloneNode()}),e.textContent=t)),M(h.afterSanitizeElements,e,null),!1)},rt=function(e,t,i){if(je&&(t==="id"||t==="name")&&(i in s||i in jt))return!1;if(!(Se&&!he[t]&&S(Ut,t))){if(!(Be&&S(Ht,t))){if(!d[t]||he[t]){if(!(at(e)&&(f.tagNameCheck instanceof RegExp&&S(f.tagNameCheck,e)||f.tagNameCheck instanceof Function&&f.tagNameCheck(e))&&(f.attributeNameCheck instanceof RegExp&&S(f.attributeNameCheck,t)||f.attributeNameCheck instanceof Function&&f.attributeNameCheck(t))||t==="is"&&f.allowCustomizedBuiltInElements&&(f.tagNameCheck instanceof RegExp&&S(f.tagNameCheck,i)||f.tagNameCheck instanceof Function&&f.tagNameCheck(i))))return!1}else if(!Le[t]){if(!S(ze,Z(i,Fe,""))){if(!((t==="src"||t==="xlink:href"||t==="href")&&e!=="script"&&tn(i,"data:")===0&&qe[e])){if(!(Ye&&!S(Ft,Z(i,Fe,"")))){if(i)return!1}}}}}}return!0},at=function(e){return e!=="annotation-xml"&&mt(e,zt)},st=function(e){M(h.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t||Ne(e))return;const i={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:d,forceKeepAttr:void 0};let c=t.length;for(;c--;){const _=t[c],{name:u,namespaceURI:O,value:C}=_,q=p(u),Me=C;let E=u==="value"?Me:nn(Me);if(i.attrName=q,i.attrValue=E,i.keepAttr=!0,i.forceKeepAttr=void 0,M(h.uponSanitizeAttribute,e,i),E=i.attrValue,Ve&&(q==="id"||q==="name")&&(W(u,e),E=Wt+E),re&&S(/((--!?|])>)|<\/(style|title)/i,E)){W(u,e);continue}if(i.forceKeepAttr)continue;if(!i.keepAttr){W(u,e);continue}if(!Xe&&S(/\/>/i,E)){W(u,e);continue}v&&me([Ee,Ae,ge],ct=>{E=Z(E,ct," ")});const lt=p(e.nodeName);if(!rt(lt,q,E)){W(u,e);continue}if(g&&typeof oe=="object"&&typeof oe.getAttributeType=="function"&&!O)switch(oe.getAttributeType(lt,q)){case"TrustedHTML":{E=g.createHTML(E);break}case"TrustedScriptURL":{E=g.createScriptURL(E);break}}if(E!==Me)try{O?e.setAttributeNS(O,u,E):e.setAttribute(u,E),Ne(e)?D(e):ut(n.removed)}catch{W(u,e)}}M(h.afterSanitizeAttributes,e,null)},$t=function r(e){let t=null;const i=nt(e);for(M(h.beforeSanitizeShadowDOM,e,null);t=i.nextNode();)M(h.uponSanitizeShadowNode,t,null),it(t),st(t),t.content instanceof A&&r(t.content);M(h.afterSanitizeShadowDOM,e,null)};return n.sanitize=function(r){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=null,i=null,c=null,_=null;if(be=!r,be&&(r="<!-->"),typeof r!="string"&&!ot(r))if(typeof r.toString=="function"){if(r=r.toString(),typeof r!="string")throw J("dirty is not a string, aborting")}else throw J("toString is not a function");if(!n.isSupported)return r;if(Re||De(e),n.removed=[],typeof r=="string"&&(V=!1),V){if(r.nodeName){const C=p(r.nodeName);if(!m[C]||j[C])throw J("root node is forbidden and cannot be sanitized in-place")}}else if(r instanceof G)t=tt("<!---->"),i=t.ownerDocument.importNode(r,!0),i.nodeType===ee.element&&i.nodeName==="BODY"||i.nodeName==="HTML"?t=i:t.appendChild(i);else{if(!k&&!v&&!P&&r.indexOf("<")===-1)return g&&se?g.createHTML(r):r;if(t=tt(r),!t)return k?null:se?X:""}t&&ye&&D(t.firstChild);const u=nt(V?r:t);for(;c=u.nextNode();)it(c),st(c),c.content instanceof A&&$t(c.content);if(V)return r;if(k){if(ae)for(_=Pt.call(t.ownerDocument);t.firstChild;)_.appendChild(t.firstChild);else _=t;return(d.shadowroot||d.shadowrootmode)&&(_=kt.call(a,_,!0)),_}let O=P?t.outerHTML:t.innerHTML;return P&&m["!doctype"]&&t.ownerDocument&&t.ownerDocument.doctype&&t.ownerDocument.doctype.name&&S(Rt,t.ownerDocument.doctype.name)&&(O="<!DOCTYPE "+t.ownerDocument.doctype.name+`>
|
|
2
|
+
`+O),v&&me([Ee,Ae,ge],C=>{O=Z(O,C," ")}),g&&se?g.createHTML(O):O},n.setConfig=function(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};De(r),Re=!0},n.clearConfig=function(){z=null,Re=!1},n.isValidAttribute=function(r,e,t){z||De({});const i=p(r),c=p(e);return rt(i,c,t)},n.addHook=function(r,e){typeof e=="function"&&K(h[r],e)},n.removeHook=function(r,e){if(e!==void 0){const t=Qt(h[r],e);return t===-1?void 0:en(h[r],t,1)[0]}return ut(h[r])},n.removeHooks=function(r){h[r]=[]},n.removeAllHooks=function(){h=At()},n}var de=yt();const He="data-temp-href-target";de.addHook("beforeSanitizeAttributes",function(o){o instanceof HTMLElement&&o.hasAttribute("target")&&o.getAttribute("target")==="_blank"&&o.setAttribute(He,"_blank")});de.addHook("afterSanitizeAttributes",function(o){o instanceof HTMLElement&&o.hasAttribute(He)&&(o.setAttribute("target","_blank"),o.setAttribute("rel","noopener noreferrer"),o.removeAttribute(He))});const Ot={USE_PROFILES:{html:!0},FORCE_BODY:!0},An=qt("div",{target:"ez8s6cm0"})({width:"100%"}),Lt=x.forwardRef(function(n,s){return te(An,{className:"stHtml","data-testid":"stHtml",ref:s,...n})}),gn={...Ot,ADD_TAGS:["script","style"],ADD_ATTR:["src","type","async","defer","nonce","crossorigin","referrerpolicy","integrity"]};function hn(o){return de.sanitize(o,gn)}const Sn=({body:o})=>{const n=x.useRef(null),s=x.useMemo(()=>hn(o),[o]);return x.useEffect(()=>{const a=n.current;return a?(a.innerHTML=s,Array.from(a.querySelectorAll("script")).forEach(A=>{const I=document.createElement("script");for(const{name:G,value:ne}of Array.from(A.attributes))try{I.setAttribute(G,ne)}catch{}A.src||(I.textContent=A.textContent),A.parentNode?.replaceChild(I,A)}),()=>{a.innerHTML=""}):void 0},[s]),te(Lt,{ref:n})},Rn=x.memo(Sn);function yn(o){return de.sanitize(o,Ot)}function On({body:o}){const n=x.useMemo(()=>yn(o),[o]);return n?te(Lt,{dangerouslySetInnerHTML:{__html:n}}):null}const Ln=x.memo(On);function bn({element:o}){const{body:n,unsafeAllowJavascript:s}=o;return s?te(Rn,{body:n}):te(Ln,{body:n})}const Dn=x.memo(bn);export{Dn as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{get as O}from"./index.CjozwSzS.js";import{I as P}from"./index.DMxc2XFp.js";const s=[{description:"angry face",emoji:"😠",emoticons:[">:(",">:[",">:-(",">:-[",">=(",">=[",">=-(",">=-["],name:"angry",tags:["mad","annoyed"]},{description:"smiling face with smiling eyes",emoji:"😊",emoticons:[':")',':"]',':"D',':-")',':-"]',':-"D','=")','="]','="D','=-")','=-"]','=-"D'],name:"blush",tags:["proud"]},{description:"broken heart",emoji:"💔",emoticons:["<\\3","</3"],name:"broken_heart",tags:[]},{description:"confused face",emoji:"😕",emoticons:[":/",":\\",":-/",":-\\","=/","=\\","=-/","=-\\"],name:"confused",tags:[]},{description:"crying face",emoji:"😢",emoticons:[":,(",":,[",":,|",":,-(",":,-[",":,-|",":'(",":'[",":'|",":'-(",":'-[",":'-|","=,(","=,[","=,|","=,-(","=,-[","=,-|","='(","='[","='|","='-(","='-[","='-|","T-T"],name:"cry",tags:["sad","tear"]},{description:"frowning face with open mouth",emoji:"😦",emoticons:[":(",":[",":-(",":-[","=(","=[","=-(","=-["],name:"frowning",tags:[]},{description:"red heart",emoji:"❤️",emoticons:["<3"],name:"heart",tags:["love"]},{description:"angry face with horns",emoji:"👿",emoticons:["]:(","]:[","]:-(","]:-[","]=(","]=[","]=-(","]=-["],name:"imp",tags:["angry","devil","evil","horns"]},{description:"smiling face with halo",emoji:"😇",emoticons:["o:)","o:]","o:D","o:-)","o:-]","o:-D","o=)","o=]","o=D","o=-)","o=-]","o=-D","O:)","O:]","O:D","O:-)","O:-]","O:-D","O=)","O=]","O=D","O=-)","O=-]","O=-D","0:)","0:]","0:D","0:-)","0:-]","0:-D","0=)","0=]","0=D","0=-)","0=-]","0=-D"],name:"innocent",tags:["angel"]},{description:"face with tears of joy",emoji:"😂",emoticons:[":,)",":,]",":,D",":,-)",":,-]",":,-D",":')",":']",":'D",":'-)",":'-]",":'-D","=,)","=,]","=,D","=,-)","=,-]","=,-D","=')","=']","='D","='-)","='-]","='-D"],name:"joy",tags:["tears"]},{description:"kissing face",emoji:"😗",emoticons:[":*",":-*","=*","=-*"],name:"kissing",tags:[]},{description:"grinning squinting face",emoji:"😆",emoticons:["x)","x]","xD","x-)","x-]","x-D","X)","X]","X-)","X-]","X-D"],name:"laughing",tags:["happy","haha"]},{description:"man",emoji:"👨",emoticons:[":3",":-3","=3","=-3",";3",";-3","x3","x-3","X3","X-3"],name:"man",tags:["mustache","father","dad"]},{description:"neutral face",emoji:"😐",emoticons:[":|",":-|","=|","=-|"],name:"neutral_face",tags:["meh"]},{description:"face without mouth",emoji:"😶",emoticons:[":-"],name:"no_mouth",tags:["mute","silence"]},{description:"face with open mouth",emoji:"😮",emoticons:[":o",":O",":0",":-o",":-O",":-0","=o","=O","=0","=-o","=-O","=-0"],name:"open_mouth",tags:["surprise","impressed","wow"]},{description:"enraged face",emoji:"😡",emoticons:[":@",":-@","=@","=-@"],name:"rage",tags:["angry"]},{description:"grinning face with smiling eyes",emoji:"😄",emoticons:[":D",":-D","=D","=-D"],name:"smile",tags:["happy","joy","laugh","pleased"]},{description:"grinning face with big eyes",emoji:"😃",emoticons:[":)",":]",":-)",":-]","=)","=]","=-)","=-]"],name:"smiley",tags:["happy","joy","haha"]},{description:"smiling face with horns",emoji:"😈",emoticons:["]:)","]:]","]:D","]:-)","]:-]","]:-D","]=)","]=]","]=D","]=-)","]=-]","]=-D"],name:"smiling_imp",tags:["devil","evil","horns"]},{description:"loudly crying face",emoji:"😭",emoticons:[":,'(",":,'[",":,'-(",":,'-[",":',(",":',[",":',-(",":',-[","=,'(","=,'[","=,'-(","=,'-[","=',(","=',[","=',-(","=',-["],name:"sob",tags:["sad","cry","bawling"]},{description:"face with tongue",emoji:"😛",emoticons:[":p",":P",":d",":-p",":-P",":-d","=p","=P","=d","=-p","=-P","=-d"],name:"stuck_out_tongue",tags:[]},{description:"squinting face with tongue",emoji:"😝",emoticons:["xP","x-p","x-P","x-d","Xp","Xd","X-p","X-P","X-d"],name:"stuck_out_tongue_closed_eyes",tags:["prank"]},{description:"winking face with tongue",emoji:"😜",emoticons:[";p",";P",";d",";-p",";-P",";-d"],name:"stuck_out_tongue_winking_eye",tags:["prank","silly"]},{description:"smiling face with sunglasses",emoji:"😎",emoticons:["8)","8]","8D","8-)","8-]","8-D","B)","B]","B-)","B-]","B-D"],name:"sunglasses",tags:["cool"]},{description:"downcast face with sweat",emoji:"😓",emoticons:[",:(",",:[",",:-(",",:-[",",=(",",=[",",=-(",",=-[","':(","':[","':-(","':-[","'=(","'=[","'=-(","'=-["],name:"sweat",tags:[]},{description:"grinning face with sweat",emoji:"😅",emoticons:[",:)",",:]",",:D",",:-)",",:-]",",:-D",",=)",",=]",",=D",",=-)",",=-]",",=-D","':)","':]","':D","':-)","':-]","':-D","'=)","'=]","'=D","'=-)","'=-]","'=-D"],name:"sweat_smile",tags:["hot"]},{description:"unamused face",emoji:"😒",emoticons:[":$",":s",":z",":S",":Z",":-$",":-s",":-z",":-S",":-Z","=$","=s","=z","=S","=Z","=-$","=-s","=-z","=-S","=-Z"],name:"unamused",tags:["meh"]},{description:"winking face",emoji:"😉",emoticons:[";)",";]",";D",";-)",";-]",";-D"],name:"wink",tags:["flirt"]}],x=/:\+1:|:-1:|:[\w-]+:/g,b=/(^|\s)[@$|*'",;.=:\-)([\]\\/<>038BOopPsSdDxXzZ]{2,5}/g,k=/(?:_|-(?!1))/g,X={padSpaceAfter:!1,emoticon:!1,accessible:!1},T=f=>{const t=Object.assign({},X,f),r=!!t.padSpaceAfter,u=!!t.emoticon,g=!!t.accessible;function d(e,i){return{type:"text",value:e,data:{hName:"span",hProperties:{role:"img",ariaLabel:i},hChildren:[{type:"text",value:e}]}}}function D(e){const i=s.find(o=>o.emoticons.includes(e)),n=s.find(o=>o.emoticons.includes(e.slice(0,-1))),a=s.find(o=>o.emoticons.includes(e.slice(1))),c=s.find(o=>o.emoticons.includes(e.slice(1,-1))),m=i||n||a||c;if(!m)return!1;const w=!(i||a)&&(c||n)?e.slice(-1):"",y=!(i||n)&&(c||a)?e.slice(0,1):"",_=r?" ":"",l=y+m.emoji+_+w;return g?d(l,m.name+" emoticon"):l}function h(e){let i=O(e);if(typeof i>"u")return!1;if(r&&(i=i+" "),g){const n=e.slice(1,-1).replace(k," ")+" emoji";return d(i,n)}return i}const p=[[x,h]];u&&p.push([b,D]);function j(e){P(e,p)}return j};export{T as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as h,g as A,az as gt,L as mt,e as et,l as wt,j as k,m as pt,ab as bt,T as yt,P as X,ac as Dt,aw as Ot,ae as xt,ay as kt,ax as St,S as Tt,k as Mt}from"./index.DMxc2XFp.js";import{h as P}from"./moment.C3j7ZXd7.js";import{u as Ct}from"./useBasicWidgetState.Bfp6TnSw.js";import{e as Yt,u as Wt,D as Et,a as Pt}from"./useIntlLocale.hRV75Xgj.js";import{E as vt}from"./ErrorOutline.esm.ZJDbmVTx.js";import"./FormClearHelper.CG2XN1_g.js";import"./timepicker.BdhzPxrv.js";import"./possibleConstructorReturn.DD9NK1Z8.js";import"./createSuper.RBO59fEm.js";import"./input.D5oh9-aB.js";import"./base-input.o9tL8MDP.js";const rt=6048e5,Ft=864e5,V=Symbol.for("constructDateFrom");function O(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&V in e?e[V](t):e instanceof Date?new e.constructor(t):new Date(t)}function b(e,t){return O(t||e,e)}let It={};function I(){return It}function v(e,t){const r=I(),n=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,a=b(e,t?.in),o=a.getDay(),i=(o<n?7:0)+o-n;return a.setDate(a.getDate()-i),a.setHours(0,0,0,0),a}function F(e,t){return v(e,{...t,weekStartsOn:1})}function nt(e,t){const r=b(e,t?.in),n=r.getFullYear(),a=O(r,0);a.setFullYear(n+1,0,4),a.setHours(0,0,0,0);const o=F(a),i=O(r,0);i.setFullYear(n,0,4),i.setHours(0,0,0,0);const f=F(i);return r.getTime()>=o.getTime()?n+1:r.getTime()>=f.getTime()?n:n-1}function j(e){const t=b(e),r=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return r.setUTCFullYear(t.getFullYear()),+e-+r}function Ht(e,...t){const r=O.bind(null,t.find(n=>typeof n=="object"));return t.map(r)}function z(e,t){const r=b(e,t?.in);return r.setHours(0,0,0,0),r}function Bt(e,t,r){const[n,a]=Ht(r?.in,e,t),o=z(n),i=z(a),f=+o-j(o),g=+i-j(i);return Math.round((f-g)/Ft)}function Lt(e,t){const r=nt(e,t),n=O(e,0);return n.setFullYear(r,0,4),n.setHours(0,0,0,0),F(n)}function Nt(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function qt(e){return!(!Nt(e)&&typeof e!="number"||isNaN(+b(e)))}function Rt(e,t){const r=b(e,t?.in);return r.setFullYear(r.getFullYear(),0,1),r.setHours(0,0,0,0),r}function _t(e,t){const r=b(e,t?.in);return Bt(r,Rt(r))+1}function Gt(e,t){const r=b(e,t?.in),n=+F(r)-+Lt(r);return Math.round(n/rt)+1}function at(e,t){const r=b(e,t?.in),n=r.getFullYear(),a=I(),o=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??a.firstWeekContainsDate??a.locale?.options?.firstWeekContainsDate??1,i=O(t?.in||e,0);i.setFullYear(n+1,0,o),i.setHours(0,0,0,0);const f=v(i,t),g=O(t?.in||e,0);g.setFullYear(n,0,o),g.setHours(0,0,0,0);const y=v(g,t);return+r>=+f?n+1:+r>=+y?n:n-1}function Qt(e,t){const r=I(),n=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,a=at(e,t),o=O(t?.in||e,0);return o.setFullYear(a,0,n),o.setHours(0,0,0,0),v(o,t)}function $t(e,t){const r=b(e,t?.in),n=+v(r,t)-+Qt(r,t);return Math.round(n/rt)+1}function s(e,t){const r=e<0?"-":"",n=Math.abs(e).toString().padStart(t,"0");return r+n}const D={y(e,t){const r=e.getFullYear(),n=r>0?r:1-r;return s(t==="yy"?n%100:n,t.length)},M(e,t){const r=e.getMonth();return t==="M"?String(r+1):s(r+1,2)},d(e,t){return s(e.getDate(),t.length)},a(e,t){const r=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];case"aaaa":default:return r==="am"?"a.m.":"p.m."}},h(e,t){return s(e.getHours()%12||12,t.length)},H(e,t){return s(e.getHours(),t.length)},m(e,t){return s(e.getMinutes(),t.length)},s(e,t){return s(e.getSeconds(),t.length)},S(e,t){const r=t.length,n=e.getMilliseconds(),a=Math.trunc(n*Math.pow(10,r-3));return s(a,t.length)}},M={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},U={G:function(e,t,r){const n=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return r.era(n,{width:"abbreviated"});case"GGGGG":return r.era(n,{width:"narrow"});case"GGGG":default:return r.era(n,{width:"wide"})}},y:function(e,t,r){if(t==="yo"){const n=e.getFullYear(),a=n>0?n:1-n;return r.ordinalNumber(a,{unit:"year"})}return D.y(e,t)},Y:function(e,t,r,n){const a=at(e,n),o=a>0?a:1-a;if(t==="YY"){const i=o%100;return s(i,2)}return t==="Yo"?r.ordinalNumber(o,{unit:"year"}):s(o,t.length)},R:function(e,t){const r=nt(e);return s(r,t.length)},u:function(e,t){const r=e.getFullYear();return s(r,t.length)},Q:function(e,t,r){const n=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(n);case"QQ":return s(n,2);case"Qo":return r.ordinalNumber(n,{unit:"quarter"});case"QQQ":return r.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return r.quarter(n,{width:"wide",context:"formatting"})}},q:function(e,t,r){const n=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(n);case"qq":return s(n,2);case"qo":return r.ordinalNumber(n,{unit:"quarter"});case"qqq":return r.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return r.quarter(n,{width:"wide",context:"standalone"})}},M:function(e,t,r){const n=e.getMonth();switch(t){case"M":case"MM":return D.M(e,t);case"Mo":return r.ordinalNumber(n+1,{unit:"month"});case"MMM":return r.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return r.month(n,{width:"wide",context:"formatting"})}},L:function(e,t,r){const n=e.getMonth();switch(t){case"L":return String(n+1);case"LL":return s(n+1,2);case"Lo":return r.ordinalNumber(n+1,{unit:"month"});case"LLL":return r.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return r.month(n,{width:"wide",context:"standalone"})}},w:function(e,t,r,n){const a=$t(e,n);return t==="wo"?r.ordinalNumber(a,{unit:"week"}):s(a,t.length)},I:function(e,t,r){const n=Gt(e);return t==="Io"?r.ordinalNumber(n,{unit:"week"}):s(n,t.length)},d:function(e,t,r){return t==="do"?r.ordinalNumber(e.getDate(),{unit:"date"}):D.d(e,t)},D:function(e,t,r){const n=_t(e);return t==="Do"?r.ordinalNumber(n,{unit:"dayOfYear"}):s(n,t.length)},E:function(e,t,r){const n=e.getDay();switch(t){case"E":case"EE":case"EEE":return r.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(n,{width:"short",context:"formatting"});case"EEEE":default:return r.day(n,{width:"wide",context:"formatting"})}},e:function(e,t,r,n){const a=e.getDay(),o=(a-n.weekStartsOn+8)%7||7;switch(t){case"e":return String(o);case"ee":return s(o,2);case"eo":return r.ordinalNumber(o,{unit:"day"});case"eee":return r.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(a,{width:"short",context:"formatting"});case"eeee":default:return r.day(a,{width:"wide",context:"formatting"})}},c:function(e,t,r,n){const a=e.getDay(),o=(a-n.weekStartsOn+8)%7||7;switch(t){case"c":return String(o);case"cc":return s(o,t.length);case"co":return r.ordinalNumber(o,{unit:"day"});case"ccc":return r.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(a,{width:"narrow",context:"standalone"});case"cccccc":return r.day(a,{width:"short",context:"standalone"});case"cccc":default:return r.day(a,{width:"wide",context:"standalone"})}},i:function(e,t,r){const n=e.getDay(),a=n===0?7:n;switch(t){case"i":return String(a);case"ii":return s(a,t.length);case"io":return r.ordinalNumber(a,{unit:"day"});case"iii":return r.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(n,{width:"short",context:"formatting"});case"iiii":default:return r.day(n,{width:"wide",context:"formatting"})}},a:function(e,t,r){const a=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(a,{width:"narrow",context:"formatting"});case"aaaa":default:return r.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(e,t,r){const n=e.getHours();let a;switch(n===12?a=M.noon:n===0?a=M.midnight:a=n/12>=1?"pm":"am",t){case"b":case"bb":return r.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(a,{width:"narrow",context:"formatting"});case"bbbb":default:return r.dayPeriod(a,{width:"wide",context:"formatting"})}},B:function(e,t,r){const n=e.getHours();let a;switch(n>=17?a=M.evening:n>=12?a=M.afternoon:n>=4?a=M.morning:a=M.night,t){case"B":case"BB":case"BBB":return r.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(a,{width:"narrow",context:"formatting"});case"BBBB":default:return r.dayPeriod(a,{width:"wide",context:"formatting"})}},h:function(e,t,r){if(t==="ho"){let n=e.getHours()%12;return n===0&&(n=12),r.ordinalNumber(n,{unit:"hour"})}return D.h(e,t)},H:function(e,t,r){return t==="Ho"?r.ordinalNumber(e.getHours(),{unit:"hour"}):D.H(e,t)},K:function(e,t,r){const n=e.getHours()%12;return t==="Ko"?r.ordinalNumber(n,{unit:"hour"}):s(n,t.length)},k:function(e,t,r){let n=e.getHours();return n===0&&(n=24),t==="ko"?r.ordinalNumber(n,{unit:"hour"}):s(n,t.length)},m:function(e,t,r){return t==="mo"?r.ordinalNumber(e.getMinutes(),{unit:"minute"}):D.m(e,t)},s:function(e,t,r){return t==="so"?r.ordinalNumber(e.getSeconds(),{unit:"second"}):D.s(e,t)},S:function(e,t){return D.S(e,t)},X:function(e,t,r){const n=e.getTimezoneOffset();if(n===0)return"Z";switch(t){case"X":return J(n);case"XXXX":case"XX":return S(n);case"XXXXX":case"XXX":default:return S(n,":")}},x:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"x":return J(n);case"xxxx":case"xx":return S(n);case"xxxxx":case"xxx":default:return S(n,":")}},O:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Z(n,":");case"OOOO":default:return"GMT"+S(n,":")}},z:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Z(n,":");case"zzzz":default:return"GMT"+S(n,":")}},t:function(e,t,r){const n=Math.trunc(+e/1e3);return s(n,t.length)},T:function(e,t,r){return s(+e,t.length)}};function Z(e,t=""){const r=e>0?"-":"+",n=Math.abs(e),a=Math.trunc(n/60),o=n%60;return o===0?r+String(a):r+String(a)+t+s(o,2)}function J(e,t){return e%60===0?(e>0?"-":"+")+s(Math.abs(e)/60,2):S(e,t)}function S(e,t=""){const r=e>0?"-":"+",n=Math.abs(e),a=s(Math.trunc(n/60),2),o=s(n%60,2);return r+a+t+o}const K=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},ot=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},At=(e,t)=>{const r=e.match(/(P+)(p+)?/)||[],n=r[1],a=r[2];if(!a)return K(e,t);let o;switch(n){case"P":o=t.dateTime({width:"short"});break;case"PP":o=t.dateTime({width:"medium"});break;case"PPP":o=t.dateTime({width:"long"});break;case"PPPP":default:o=t.dateTime({width:"full"});break}return o.replace("{{date}}",K(n,t)).replace("{{time}}",ot(a,t))},Xt={p:ot,P:At},Vt=/^D+$/,jt=/^Y+$/,zt=["D","DD","YY","YYYY"];function Ut(e){return Vt.test(e)}function Zt(e){return jt.test(e)}function Jt(e,t,r){const n=Kt(e,t,r);if(console.warn(n),zt.includes(e))throw new RangeError(n)}function Kt(e,t,r){const n=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${n} to the input \`${r}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const te=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,ee=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,re=/^'([^]*?)'?$/,ne=/''/g,ae=/[a-zA-Z]/;function tt(e,t,r){const n=I(),a=r?.locale??n.locale??Yt,o=r?.firstWeekContainsDate??r?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=r?.weekStartsOn??r?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,f=b(e,r?.in);if(!qt(f))throw new RangeError("Invalid time value");let g=t.match(ee).map(u=>{const d=u[0];if(d==="p"||d==="P"){const c=Xt[d];return c(u,a.formatLong)}return u}).join("").match(te).map(u=>{if(u==="''")return{isToken:!1,value:"'"};const d=u[0];if(d==="'")return{isToken:!1,value:oe(u)};if(U[d])return{isToken:!0,value:u};if(d.match(ae))throw new RangeError("Format string contains an unescaped latin alphabet character `"+d+"`");return{isToken:!1,value:u}});a.localize.preprocessor&&(g=a.localize.preprocessor(f,g));const y={firstWeekContainsDate:o,weekStartsOn:i,locale:a};return g.map(u=>{if(!u.isToken)return u.value;const d=u.value;(!r?.useAdditionalWeekYearTokens&&Zt(d)||!r?.useAdditionalDayOfYearTokens&&Ut(d))&&Jt(d,t,String(e));const c=U[d[0]];return c(f,d,a.localize,y)}).join("")}function oe(e){const t=e.match(re);return t?t[1].replace(ne,"'"):e}const H="YYYY/MM/DD";function B(e){return e.map(t=>new Date(t))}function se(e){return e?e.map(t=>P(t).format(H)):[]}function ie({disabled:e,element:t,widgetMgr:r,fragmentId:n}){const a=A(),o=h.useContext(gt),[i,f]=Ct({getStateFromWidgetMgr:ce,getDefaultStateFromProto:ue,getCurrStateFromProto:de,updateWidgetMgrState:fe,element:t,widgetMgr:r,fragmentId:n}),[g,y]=h.useState(!1),[u,d]=h.useState(null),{colors:c,fontSizes:L,fontWeights:ct,lineHeights:Q,spacing:m,sizes:w}=A(),{locale:ut}=h.useContext(mt),C=Wt(ut),x=h.useMemo(()=>P(t.min,H).toDate(),[t.min]),T=h.useMemo(()=>it(t),[t]),dt=h.useMemo(()=>{if(!t.isRange)return!1;const l=P().subtract(2,"years").toDate();return x<l},[t.isRange,x]),ft=t.default.length===0&&!e,N=h.useMemo(()=>t.format.replaceAll(/[a-zA-Z]/g,"9"),[t.format]),Y=h.useMemo(()=>t.format.replaceAll("Y","y").replaceAll("D","d"),[t.format]),q=h.useMemo(()=>tt(x,Y,{locale:C}),[x,Y,C]),R=h.useMemo(()=>T?tt(T,Y,{locale:C}):"",[T,Y,C]),$=h.useCallback(l=>{if(!l)return null;if(t.isRange){const p=l==="End"?`before ${R}`:`after ${q}`;return`**Error**: ${l} date set outside allowed range. Please select a date ${p}.`}return`**Error**: Date set outside allowed range. Please select a date between ${q} and ${R}.`},[t.isRange,R,q]),lt=h.useCallback(({date:l})=>{if(d(null),et(l)){f({value:[],fromUi:!0}),y(!0);return}const p=Array.isArray(l)?l.filter(_=>!!_).map(_=>G(_)):G(l),{errorType:W,newDates:E}=st(p,x,T);W&&d($(W)),f({value:E,fromUi:!0}),y(!E)},[f,$,d,x,T]),ht=h.useCallback(()=>{if(!g)return;const l=B(t.default);f({value:l,fromUi:!0}),y(!l)},[g,t,f]);return wt("div",{className:"stDateInput","data-testid":"stDateInput",children:[k(Dt,{label:t.label,disabled:e,labelVisibility:pt(t.labelVisibility?.value),children:t.help&&k(bt,{children:k(yt,{content:t.help,placement:X.TOP_RIGHT})})}),k(Pt,{locale:C,density:Et.high,formatString:Y,mask:t.isRange?`${N} – ${N}`:N,placeholder:t.isRange?`${t.format} – ${t.format}`:t.format,disabled:e,onChange:lt,onClose:ht,quickSelect:dt,overrides:{Popover:{props:{ignoreBoundary:o,placement:Ot.bottomLeft,overrides:{Body:{style:{marginTop:m.px}}}}},CalendarContainer:{style:{fontSize:L.sm,paddingRight:m.sm,paddingLeft:m.sm,paddingBottom:m.sm,paddingTop:m.sm}},Week:{style:{fontSize:L.sm}},Day:{style:({$pseudoHighlighted:l,$pseudoSelected:p,$selected:W,$isHovered:E})=>({fontSize:L.sm,lineHeight:Q.base,"::before":{backgroundColor:W||p||l||E?`${c.darkenedBgMix15} !important`:c.transparent},"::after":{borderColor:c.transparent},...Mt(a)&&E&&p&&!W?{color:c.secondaryBg}:{}})},PrevButton:{style:()=>({display:"flex",alignItems:"center",justifyContent:"center",":active":{backgroundColor:c.transparent},":focus":{backgroundColor:c.transparent,outline:0}})},NextButton:{style:{display:"flex",alignItems:"center",justifyContent:"center",":active":{backgroundColor:c.transparent},":focus":{backgroundColor:c.transparent,outline:0}}},Input:{props:{maskChar:null,endEnhancer:u&&k(kt,{content:k(Tt,{source:u,allowHTML:!1}),placement:X.TOP_RIGHT,error:!0,children:k(St,{content:vt,size:"lg"})}),overrides:{EndEnhancer:{style:{color:c.redTextColor,backgroundColor:c.transparent}},Root:{style:({$isFocused:l})=>{const p=xt(c,l);return{borderLeftWidth:w.borderWidth,borderRightWidth:w.borderWidth,borderTopWidth:w.borderWidth,borderBottomWidth:w.borderWidth,paddingRight:m.twoXS,borderTopColor:p,borderRightColor:p,borderBottomColor:p,borderLeftColor:p,...u&&{backgroundColor:c.redBackgroundColor}}}},ClearIcon:{props:{overrides:{Svg:{style:{color:c.grayTextColor,padding:m.threeXS,height:w.clearIconSize,width:w.clearIconSize,":hover":{fill:c.bodyText}}}}}},InputContainer:{style:{backgroundColor:"transparent"}},Input:{style:{fontWeight:ct.normal,paddingRight:m.sm,paddingLeft:m.md,paddingBottom:m.sm,paddingTop:m.sm,lineHeight:Q.inputWidget,"::placeholder":{color:c.fadedText60},...u&&{color:c.redTextColor}},props:{"data-testid":"stDateInputField"}}}}},QuickSelect:{props:{overrides:{ControlContainer:{style:{height:w.minElementHeight,borderLeftWidth:w.borderWidth,borderRightWidth:w.borderWidth,borderTopWidth:w.borderWidth,borderBottomWidth:w.borderWidth}}}}}},value:i,minDate:x,maxDate:T,range:t.isRange,clearable:ft})]})}function ce(e,t){const r=e.getStringArrayValue(t),n=r!==void 0?r:t.default||[];return B(n)}function ue(e){return B(e.default)??[]}function de(e){return B(e.value)??[]}function fe(e,t,r,n){const a=P(e.min,H).toDate(),o=it(e);let i=!0;const f=(r.value||[]).map(y=>G(y)),{errorType:g}=st(f,a,o);g&&(i=!1),i&&t.setStringArrayValue(e,se(r.value),{fromUi:r.fromUi},n)}function st(e,t,r){const n=[];let a=null;return et(e)?{errorType:null,newDates:[]}:(Array.isArray(e)?e.forEach(o=>{o&&(r&&o>r?a="End":o<t&&(a="Start"),n.push(o))}):e&&(r&&e>r?a="End":e<t&&(a="Start"),n.push(e)),{errorType:a,newDates:n})}function it(e){const t=e.max;return t&&t.length>0?P(t,H).toDate():void 0}function G(e){const t=new Date(e.getTime());return t.setHours(0,0,0,0),t}const ke=h.memo(ie);export{ke as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{aV as b,aW as p,aX as y,aY as h,aZ as A,a_ as x}from"./index.DMxc2XFp.js";const m=/[#.]/g;function j(r,e){const n=r||"",t={};let s=0,o,f;for(;s<n.length;){m.lastIndex=s;const a=m.exec(n),i=n.slice(s,a?a.index:n.length);i&&(o?o==="#"?t.id=i:Array.isArray(t.className)?t.className.push(i):t.className=[i]:f=i,s+=i.length),a&&(o=a[0],s++)}return{type:"element",tagName:f||e||"div",properties:t,children:[]}}function g(r,e,n){const t=n?L(n):void 0;function s(o,f,...a){let i;if(o==null){i={type:"root",children:[]};const c=f;a.unshift(c)}else{i=j(o,e);const c=i.tagName.toLowerCase(),u=t?t.get(c):void 0;if(i.tagName=u||c,M(f))a.unshift(f);else for(const[w,N]of Object.entries(f))C(r,i.properties,w,N)}for(const c of a)l(i.children,c);return i.type==="element"&&i.tagName==="template"&&(i.content={type:"root",children:i.children},i.children=[]),i}return s}function M(r){if(r===null||typeof r!="object"||Array.isArray(r))return!0;if(typeof r.type!="string")return!1;const e=r,n=Object.keys(r);for(const t of n){const s=e[t];if(s&&typeof s=="object"){if(!Array.isArray(s))return!0;const o=s;for(const f of o)if(typeof f!="number"&&typeof f!="string")return!0}}return!!("children"in r&&Array.isArray(r.children))}function C(r,e,n,t){const s=b(r,n);let o;if(t!=null){if(typeof t=="number"){if(Number.isNaN(t))return;o=t}else typeof t=="boolean"?o=t:typeof t=="string"?s.spaceSeparated?o=p(t):s.commaSeparated?o=y(t):s.commaOrSpaceSeparated?o=p(y(t).join(" ")):o=d(s,s.property,t):Array.isArray(t)?o=[...t]:o=s.property==="style"?S(t):String(t);if(Array.isArray(o)){const f=[];for(const a of o)f.push(d(s,s.property,a));o=f}s.property==="className"&&Array.isArray(e.className)&&(o=e.className.concat(o)),e[s.property]=o}}function l(r,e){if(e!=null)if(typeof e=="number"||typeof e=="string")r.push({type:"text",value:String(e)});else if(Array.isArray(e))for(const n of e)l(r,n);else if(typeof e=="object"&&"type"in e)e.type==="root"?l(r,e.children):r.push(e);else throw new Error("Expected node, nodes, or string, got `"+e+"`")}function d(r,e,n){if(typeof n=="string"){if(r.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((r.boolean||r.overloadedBoolean)&&(n===""||h(n)===h(e)))return!0}return n}function S(r){const e=[];for(const[n,t]of Object.entries(r))e.push([n,t].join(": "));return e.join("; ")}function L(r){const e=new Map;for(const n of r)e.set(n.toLowerCase(),n);return e}const k=["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","solidColor","textArea","textPath"],O=g(A,"div"),D=g(x,"g",k),F={html:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};export{O as h,D as s,F as w};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{av as U,j as u,aw as _,ae as z,P as h,ax as $,S as G,ay as X,k as Z,e as q,r as s,g as J,az as K,L as Q,l as oo,m as to,ab as ro,T as eo,ac as no}from"./index.DMxc2XFp.js";import{h as x}from"./moment.C3j7ZXd7.js";import{u as ao,D as so,a as io}from"./useIntlLocale.hRV75Xgj.js";import{u as lo}from"./useBasicWidgetState.Bfp6TnSw.js";import{S as co}from"./styled-components.C3R090At.js";import{E as po}from"./ErrorOutline.esm.ZJDbmVTx.js";import"./timepicker.BdhzPxrv.js";import"./possibleConstructorReturn.DD9NK1Z8.js";import"./createSuper.RBO59fEm.js";import"./input.D5oh9-aB.js";import"./base-input.o9tL8MDP.js";import"./FormClearHelper.CG2XN1_g.js";const go=({theme:o,isInSidebar:t,step:r,minTime:c,maxTime:f,disabled:p,clearable:g,error:e})=>({Popover:{props:{ignoreBoundary:t,placement:_.bottomLeft,overrides:{Body:{style:{marginTop:o.spacing.px}}}}},CalendarContainer:{style:{fontSize:o.fontSizes.sm,paddingRight:o.spacing.sm,paddingLeft:o.spacing.sm,paddingBottom:o.spacing.none,paddingTop:o.spacing.sm}},Week:{style:{fontSize:o.fontSizes.sm}},Day:{style:({$pseudoHighlighted:i,$pseudoSelected:a,$selected:C,$isHovered:y})=>({fontSize:o.fontSizes.sm,lineHeight:o.lineHeights.base,"::before":{backgroundColor:C||a||i||y?`${o.colors.darkenedBgMix15} !important`:o.colors.transparent},"::after":{borderColor:o.colors.transparent},...Z(o)&&y&&a&&!C?{color:o.colors.secondaryBg}:{}})},PrevButton:{style:()=>({display:"flex",alignItems:"center",justifyContent:"center",":active":{backgroundColor:o.colors.transparent},":focus":{backgroundColor:o.colors.transparent,outline:0}})},NextButton:{style:()=>({display:"flex",alignItems:"center",justifyContent:"center",":active":{backgroundColor:o.colors.transparent},":focus":{backgroundColor:o.colors.transparent,outline:0}})},Input:{props:{maskChar:null,endEnhancer:e&&u(X,{content:u(G,{source:e,allowHTML:!1}),placement:h.TOP_RIGHT,error:!0,children:u($,{content:po,size:"lg"})}),overrides:{EndEnhancer:{style:{color:e?o.colors.redTextColor:o.colors.grayTextColor,backgroundColor:o.colors.transparent}},Root:{style:({$isFocused:i})=>{const a=z(o.colors,i);return{borderLeftWidth:o.sizes.borderWidth,borderRightWidth:o.sizes.borderWidth,borderTopWidth:o.sizes.borderWidth,borderBottomWidth:o.sizes.borderWidth,paddingRight:o.spacing.twoXS,borderTopColor:a,borderRightColor:a,borderBottomColor:a,borderLeftColor:a,...e&&{backgroundColor:o.colors.redBackgroundColor}}}},ClearIcon:{props:{overrides:{Svg:{style:{color:o.colors.grayTextColor,padding:o.spacing.threeXS,height:o.sizes.clearIconSize,width:o.sizes.clearIconSize,":hover":{fill:o.colors.bodyText}}}}}},InputContainer:{style:{backgroundColor:"transparent"}},Input:{style:{fontWeight:o.fontWeights.normal,paddingRight:o.spacing.sm,paddingLeft:o.spacing.md,paddingBottom:o.spacing.sm,paddingTop:o.spacing.sm,lineHeight:o.lineHeights.inputWidget,"::placeholder":{color:o.colors.fadedText60},...e&&{color:o.colors.redTextColor}},props:{"data-testid":"stDateTimeInputField"}}}}},TimeSelectContainer:{style:{paddingTop:o.spacing.none,paddingBottom:o.spacing.none}},TimeSelectFormControl:{style:{marginBottom:o.spacing.none},props:{overrides:{Label:{component:()=>null}}}},TimeSelect:{props:{step:r,format:"24",disabled:p,nullable:g,minTime:c,maxTime:f,overrides:{Select:{props:{disabled:p,overrides:{ControlContainer:{style:({$isFocused:i})=>{const a=z(o.colors,i);return{height:o.sizes.minElementHeight,borderLeftWidth:o.sizes.borderWidth,borderRightWidth:o.sizes.borderWidth,borderTopWidth:o.sizes.borderWidth,borderBottomWidth:o.sizes.borderWidth,borderTopColor:a,borderRightColor:a,borderBottomColor:a,borderLeftColor:a}}},IconsContainer:{style:()=>({paddingRight:o.spacing.sm})},ValueContainer:{style:()=>({lineHeight:o.lineHeights.inputWidget,paddingRight:o.spacing.sm,paddingLeft:o.spacing.md,paddingBottom:o.spacing.sm,paddingTop:o.spacing.sm})},SingleValue:{style:{fontWeight:o.fontWeights.normal},props:{"data-testid":"stDateTimeInputTimeDisplay"}},Dropdown:{style:()=>({paddingTop:o.spacing.none,paddingBottom:o.spacing.none,boxShadow:"none",maxHeight:o.sizes.maxDropdownHeight})},DropdownListItem:{component:co},Popover:{props:{ignoreBoundary:t,overrides:{Body:{style:()=>({marginTop:o.spacing.px})}}}},Placeholder:{style:()=>({color:o.colors.fadedText60})},SelectArrow:{component:U,props:{overrides:{Svg:{style:()=>({width:o.iconSizes.xl,height:o.iconSizes.xl})}}}}}}}}}}}),k="YYYY/MM/DD, HH:mm",uo=(o,t)=>{const r=o.getStringArrayValue(t);return r&&r.length>0?r[0]:null},fo=o=>o.default?.length?o.default[0]:null,mo=o=>o.value?.length?o.value[0]:null,M=o=>{let t;if(Array.isArray(o)?t=o.find(c=>c instanceof Date):t=o,!t||Number.isNaN(t.getTime()))return null;const r=new Date(t.getTime());return r.setSeconds(0,0),r},b=o=>{if(q(o)||o==="")return null;const t=x(o,k,!0);return t.isValid()?M(t.toDate()):null},I=(o,t)=>o.getFullYear()===t.getFullYear()&&o.getMonth()===t.getMonth()&&o.getDate()===t.getDate(),B=(o,t)=>{const r=new Date(o.getTime());return r.setHours(t.getHours(),t.getMinutes(),0,0),r},bo=(o,t,r,c)=>{const f=b(o.min),p=b(o.max),g=e=>{t.setStringArrayValue(o,e?[e]:[],{fromUi:r.fromUi},c)};if(r.value){const e=b(r.value);if(e){f&&e<f||p&&e>p||g(r.value);return}}g(r.value)};function To({disabled:o,element:t,widgetMgr:r,fragmentId:c}){const f=J(),p=s.useContext(K),g=s.useRef(null),[e,i]=lo({getStateFromWidgetMgr:uo,getDefaultStateFromProto:fo,getCurrStateFromProto:mo,updateWidgetMgrState:bo,element:t,widgetMgr:r,fragmentId:c}),{locale:a}=s.useContext(Q),C=ao(a),y=t.step?Number(t.step):900,l=s.useMemo(()=>b(t.min),[t.min]),d=s.useMemo(()=>b(t.max),[t.max]),T=s.useMemo(()=>b(e),[e]),[n,v]=s.useState(T),[H,L]=s.useState(T);T!==H&&(v(T),L(T));const P=l??void 0,V=d??void 0,E=s.useMemo(()=>{if(!(!n||!l))return I(n,l)?B(n,l):void 0},[n,l]),R=s.useMemo(()=>{if(!(!n||!d))return I(n,d)?B(n,d):void 0},[n,d]),w=t.format.replaceAll(/[a-zA-Z]/g,"9"),D=`${t.format.replaceAll("Y","y").replaceAll("D","d")}, HH:mm`,A=`${w}, 99:99`,F=`${t.format}, HH:MM`,W=(t.default&&t.default.length>0?t.default[0]:"").length===0&&!o,O=s.useMemo(()=>{if(!n)return null;if(l&&n<l||d&&n>d){const m=x(l).format(D),S=x(d).format(D);return`**Error**: Date and time set outside allowed range. Please select a date and time between ${m} and ${S}.`}return null},[n,l,d,D]),N=s.useCallback(({date:m})=>{const S=M(m);v(S),g.current?.open?.()},[]),Y=s.useCallback(()=>{const m=n?x(n).format(k):null;m!==e&&i({value:m,fromUi:!0})},[n,e,i]),j=go({theme:f,isInSidebar:p,step:y,minTime:E,maxTime:R,disabled:o,clearable:W,error:O});return oo("div",{className:"stDateTimeInput","data-testid":"stDateTimeInput",children:[u(no,{label:t.label,disabled:o,labelVisibility:to(t.labelVisibility?.value),children:t.help&&u(ro,{children:u(eo,{content:t.help,placement:h.TOP_RIGHT})})}),u(io,{ref:g,locale:C,density:so.high,value:n,onChange:N,onClose:Y,minDate:P,maxDate:V,disabled:o,timeSelectStart:!0,formatString:D,mask:A,placeholder:F,clearable:W,overrides:j,"aria-label":t.label})]})}const Lo=s.memo(To);export{Lo as default};
|