@webority/ui-react 0.120.1 → 0.122.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/canvas-kit/kit.css +2 -0
- package/dist/canvas-kit/kit.js +15654 -15303
- package/dist/canvas-kit/manifest.json +126 -2
- package/dist/canvas-kit/release.json +8 -8
- package/dist/components/AppAutocomplete.js +1 -1
- package/dist/components/AppChart.js +1 -1
- package/dist/components/AppColorField.js +1 -1
- package/dist/components/AppColumnMenu.js +1 -1
- package/dist/components/AppConfirmDialog.js +1 -1
- package/dist/components/AppConfirmProvider.js +1 -0
- package/dist/components/AppCountryFlag.js +1 -1
- package/dist/components/AppCountrySelect.js +1 -1
- package/dist/components/AppDataTable.js +1 -1
- package/dist/components/AppDatePicker.js +1 -1
- package/dist/components/AppDateRangePicker.js +1 -1
- package/dist/components/AppDrawer.js +1 -1
- package/dist/components/AppFilePicker.js +1 -1
- package/dist/components/AppImagePicker.js +1 -1
- package/dist/components/AppLink.js +1 -1
- package/dist/components/AppModal.js +1 -1
- package/dist/components/AppMultiSelect.js +1 -1
- package/dist/components/AppNumberInput.js +1 -1
- package/dist/components/AppOtpInput.js +1 -1
- package/dist/components/AppPhoneNumberInput.js +1 -1
- package/dist/components/AppRadioGroup.js +1 -1
- package/dist/components/AppRepeater.js +1 -1
- package/dist/components/AppSelect.js +1 -1
- package/dist/components/AppSlider.js +1 -1
- package/dist/components/AppTagInput.js +1 -1
- package/dist/components/AppTimePicker.js +1 -1
- package/dist/components/iconGlyphs.g.js +1 -1
- package/dist/components/iconVariants.g.js +1 -1
- package/dist/guidance.json +1 -1
- package/dist/lib/flagStyles.js +1 -0
- package/dist/lib/pageScrollLock.js +1 -0
- package/dist/types/components/AppAutocomplete.d.ts +5 -0
- package/dist/types/components/AppChart.d.ts +2 -0
- package/dist/types/components/AppColorField.d.ts +6 -0
- package/dist/types/components/AppConfirmDialog.d.ts +3 -0
- package/dist/types/components/AppConfirmProvider.d.ts +27 -0
- package/dist/types/components/AppCountrySelect.d.ts +5 -0
- package/dist/types/components/AppDatePicker.d.ts +5 -0
- package/dist/types/components/AppDateRangePicker.d.ts +5 -0
- package/dist/types/components/AppFilePicker.d.ts +6 -0
- package/dist/types/components/AppImagePicker.d.ts +6 -0
- package/dist/types/components/AppMultiSelect.d.ts +5 -0
- package/dist/types/components/AppNumberInput.d.ts +5 -0
- package/dist/types/components/AppOtpInput.d.ts +5 -0
- package/dist/types/components/AppPhoneNumberInput.d.ts +5 -0
- package/dist/types/components/AppRadioGroup.d.ts +6 -0
- package/dist/types/components/AppRepeater.d.ts +2 -2
- package/dist/types/components/AppSelect.d.ts +5 -0
- package/dist/types/components/AppSlider.d.ts +5 -0
- package/dist/types/components/AppTagInput.d.ts +5 -0
- package/dist/types/components/AppTimePicker.d.ts +5 -0
- package/dist/types/components/iconGlyphs.g.d.ts +3 -0
- package/dist/types/components/iconVariants.g.d.ts +15 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/lib/flagStyles.d.ts +2 -0
- package/dist/types/lib/pageScrollLock.d.ts +1 -0
- package/dist/ui-react.js +1 -1
- package/package.json +8 -8
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"kind": "WeborityWeb",
|
|
3
3
|
"library": {
|
|
4
4
|
"name": "@webority/ui-react",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.122.0"
|
|
6
6
|
},
|
|
7
7
|
"rendererProtocolVersion": 13,
|
|
8
8
|
"platform": "Web",
|
|
@@ -810,6 +810,13 @@
|
|
|
810
810
|
"required": false,
|
|
811
811
|
"description": "Shows the list open, for a design preview or a controlled caller."
|
|
812
812
|
},
|
|
813
|
+
{
|
|
814
|
+
"name": "optional",
|
|
815
|
+
"type": "boolean",
|
|
816
|
+
"required": false,
|
|
817
|
+
"description": "Ends the label with (optional) when the field is not required. Required wins when both are set.",
|
|
818
|
+
"default": false
|
|
819
|
+
},
|
|
813
820
|
{
|
|
814
821
|
"name": "options",
|
|
815
822
|
"type": "array",
|
|
@@ -2805,6 +2812,12 @@
|
|
|
2805
2812
|
"required": false,
|
|
2806
2813
|
"description": "A gauge's named stretches of its scale, each up to a value."
|
|
2807
2814
|
},
|
|
2815
|
+
{
|
|
2816
|
+
"name": "centerLabel",
|
|
2817
|
+
"type": "string",
|
|
2818
|
+
"required": false,
|
|
2819
|
+
"description": "Caption under the total in the centre of a donut. Default Total. Donut only."
|
|
2820
|
+
},
|
|
2808
2821
|
{
|
|
2809
2822
|
"name": "className",
|
|
2810
2823
|
"type": "string",
|
|
@@ -4354,6 +4367,13 @@
|
|
|
4354
4367
|
"required": false,
|
|
4355
4368
|
"description": "Form field name on the text box, the control that posts."
|
|
4356
4369
|
},
|
|
4370
|
+
{
|
|
4371
|
+
"name": "optional",
|
|
4372
|
+
"type": "boolean",
|
|
4373
|
+
"required": false,
|
|
4374
|
+
"description": "Ends the label with (optional) when the field is not required. Required wins when both are set.",
|
|
4375
|
+
"default": false
|
|
4376
|
+
},
|
|
4357
4377
|
{
|
|
4358
4378
|
"name": "required",
|
|
4359
4379
|
"type": "boolean",
|
|
@@ -5559,6 +5579,12 @@
|
|
|
5559
5579
|
"description": "Styles the confirm button as destructive; with no tone it also picks the delete icon.",
|
|
5560
5580
|
"default": false
|
|
5561
5581
|
},
|
|
5582
|
+
{
|
|
5583
|
+
"name": "icon",
|
|
5584
|
+
"type": "node",
|
|
5585
|
+
"required": false,
|
|
5586
|
+
"description": "Replaces the tone's glyph. A string is an icon name; a node is drawn as given. An image still wins over it."
|
|
5587
|
+
},
|
|
5562
5588
|
{
|
|
5563
5589
|
"name": "iconSize",
|
|
5564
5590
|
"type": "number",
|
|
@@ -6296,6 +6322,13 @@
|
|
|
6296
6322
|
"required": false,
|
|
6297
6323
|
"description": "Shows the list open, for a design preview or a controlled caller."
|
|
6298
6324
|
},
|
|
6325
|
+
{
|
|
6326
|
+
"name": "optional",
|
|
6327
|
+
"type": "boolean",
|
|
6328
|
+
"required": false,
|
|
6329
|
+
"description": "Ends the label with (optional) when the field is not required. Required wins when both are set.",
|
|
6330
|
+
"default": false
|
|
6331
|
+
},
|
|
6299
6332
|
{
|
|
6300
6333
|
"name": "placeholder",
|
|
6301
6334
|
"type": "string",
|
|
@@ -6971,6 +7004,13 @@
|
|
|
6971
7004
|
"required": false,
|
|
6972
7005
|
"description": "The form field name the ISO date posts under."
|
|
6973
7006
|
},
|
|
7007
|
+
{
|
|
7008
|
+
"name": "optional",
|
|
7009
|
+
"type": "boolean",
|
|
7010
|
+
"required": false,
|
|
7011
|
+
"description": "Ends the label with (optional) when the field is not required. Required wins when both are set.",
|
|
7012
|
+
"default": false
|
|
7013
|
+
},
|
|
6974
7014
|
{
|
|
6975
7015
|
"name": "placeholder",
|
|
6976
7016
|
"type": "string",
|
|
@@ -7184,6 +7224,13 @@
|
|
|
7184
7224
|
"required": false,
|
|
7185
7225
|
"description": "The earliest selectable date, as an ISO date string."
|
|
7186
7226
|
},
|
|
7227
|
+
{
|
|
7228
|
+
"name": "optional",
|
|
7229
|
+
"type": "boolean",
|
|
7230
|
+
"required": false,
|
|
7231
|
+
"description": "Ends the label with (optional) when the field is not required. Required wins when both are set.",
|
|
7232
|
+
"default": false
|
|
7233
|
+
},
|
|
7187
7234
|
{
|
|
7188
7235
|
"name": "placeholder",
|
|
7189
7236
|
"type": "string",
|
|
@@ -8781,6 +8828,13 @@
|
|
|
8781
8828
|
"required": false,
|
|
8782
8829
|
"description": "Form field name."
|
|
8783
8830
|
},
|
|
8831
|
+
{
|
|
8832
|
+
"name": "optional",
|
|
8833
|
+
"type": "boolean",
|
|
8834
|
+
"required": false,
|
|
8835
|
+
"description": "Ends the label with (optional) when the field is not required. Required wins when both are set.",
|
|
8836
|
+
"default": false
|
|
8837
|
+
},
|
|
8784
8838
|
{
|
|
8785
8839
|
"name": "required",
|
|
8786
8840
|
"type": "boolean",
|
|
@@ -9969,6 +10023,13 @@
|
|
|
9969
10023
|
"required": false,
|
|
9970
10024
|
"description": "The form field name. The chosen file, or the crop when cropping, is written into the file input, so an uncontrolled form posts it."
|
|
9971
10025
|
},
|
|
10026
|
+
{
|
|
10027
|
+
"name": "optional",
|
|
10028
|
+
"type": "boolean",
|
|
10029
|
+
"required": false,
|
|
10030
|
+
"description": "Ends the label with (optional) when the field is not required. Required wins when both are set.",
|
|
10031
|
+
"default": false
|
|
10032
|
+
},
|
|
9972
10033
|
{
|
|
9973
10034
|
"name": "outputSize",
|
|
9974
10035
|
"type": "number",
|
|
@@ -12593,6 +12654,13 @@
|
|
|
12593
12654
|
"required": false,
|
|
12594
12655
|
"description": "The field name posted with the form."
|
|
12595
12656
|
},
|
|
12657
|
+
{
|
|
12658
|
+
"name": "optional",
|
|
12659
|
+
"type": "boolean",
|
|
12660
|
+
"required": false,
|
|
12661
|
+
"description": "Ends the label with (optional) when the field is not required. Required wins when both are set.",
|
|
12662
|
+
"default": false
|
|
12663
|
+
},
|
|
12596
12664
|
{
|
|
12597
12665
|
"name": "options",
|
|
12598
12666
|
"type": "array",
|
|
@@ -13370,6 +13438,13 @@
|
|
|
13370
13438
|
"required": false,
|
|
13371
13439
|
"description": "The input's name, for forms."
|
|
13372
13440
|
},
|
|
13441
|
+
{
|
|
13442
|
+
"name": "optional",
|
|
13443
|
+
"type": "boolean",
|
|
13444
|
+
"required": false,
|
|
13445
|
+
"description": "Ends the label with (optional) when the field is not required. Required wins when both are set.",
|
|
13446
|
+
"default": false
|
|
13447
|
+
},
|
|
13373
13448
|
{
|
|
13374
13449
|
"name": "placeholder",
|
|
13375
13450
|
"type": "string",
|
|
@@ -13659,6 +13734,13 @@
|
|
|
13659
13734
|
"required": false,
|
|
13660
13735
|
"description": "The form field name, so a plain form post includes the code."
|
|
13661
13736
|
},
|
|
13737
|
+
{
|
|
13738
|
+
"name": "optional",
|
|
13739
|
+
"type": "boolean",
|
|
13740
|
+
"required": false,
|
|
13741
|
+
"description": "Ends the label with (optional) when the field is not required. Required wins when both are set.",
|
|
13742
|
+
"default": false
|
|
13743
|
+
},
|
|
13662
13744
|
{
|
|
13663
13745
|
"name": "required",
|
|
13664
13746
|
"type": "boolean",
|
|
@@ -14141,6 +14223,13 @@
|
|
|
14141
14223
|
"required": false,
|
|
14142
14224
|
"description": "The form field name."
|
|
14143
14225
|
},
|
|
14226
|
+
{
|
|
14227
|
+
"name": "optional",
|
|
14228
|
+
"type": "boolean",
|
|
14229
|
+
"required": false,
|
|
14230
|
+
"description": "Ends the label with (optional) when the field is not required. Required wins when both are set.",
|
|
14231
|
+
"default": false
|
|
14232
|
+
},
|
|
14144
14233
|
{
|
|
14145
14234
|
"name": "placeholder",
|
|
14146
14235
|
"type": "string",
|
|
@@ -15221,6 +15310,13 @@
|
|
|
15221
15310
|
"required": false,
|
|
15222
15311
|
"description": "Shared name of the radios. Defaults to a generated one."
|
|
15223
15312
|
},
|
|
15313
|
+
{
|
|
15314
|
+
"name": "optional",
|
|
15315
|
+
"type": "boolean",
|
|
15316
|
+
"required": false,
|
|
15317
|
+
"description": "Ends the label with (optional) when the field is not required. Required wins when both are set.",
|
|
15318
|
+
"default": false
|
|
15319
|
+
},
|
|
15224
15320
|
{
|
|
15225
15321
|
"name": "options",
|
|
15226
15322
|
"type": "array",
|
|
@@ -15619,7 +15715,7 @@
|
|
|
15619
15715
|
"name": "addVariant",
|
|
15620
15716
|
"type": "string",
|
|
15621
15717
|
"required": false,
|
|
15622
|
-
"description": "The add
|
|
15718
|
+
"description": "The add control's variant: an AppButton variant such as primary, outline or ghost, or link for a small text link with a plus icon. An unknown value warns in development.",
|
|
15623
15719
|
"default": "secondary"
|
|
15624
15720
|
},
|
|
15625
15721
|
{
|
|
@@ -18218,6 +18314,13 @@
|
|
|
18218
18314
|
"required": false,
|
|
18219
18315
|
"description": "Shows the list open, for a design preview or a controlled caller."
|
|
18220
18316
|
},
|
|
18317
|
+
{
|
|
18318
|
+
"name": "optional",
|
|
18319
|
+
"type": "boolean",
|
|
18320
|
+
"required": false,
|
|
18321
|
+
"description": "Ends the label with (optional) when the field is not required. Required wins when both are set.",
|
|
18322
|
+
"default": false
|
|
18323
|
+
},
|
|
18221
18324
|
{
|
|
18222
18325
|
"name": "options",
|
|
18223
18326
|
"type": "array",
|
|
@@ -19817,6 +19920,13 @@
|
|
|
19817
19920
|
"required": false,
|
|
19818
19921
|
"description": "Form field name (single mode)."
|
|
19819
19922
|
},
|
|
19923
|
+
{
|
|
19924
|
+
"name": "optional",
|
|
19925
|
+
"type": "boolean",
|
|
19926
|
+
"required": false,
|
|
19927
|
+
"description": "Ends the label with (optional) when the field is not required. Required wins when both are set.",
|
|
19928
|
+
"default": false
|
|
19929
|
+
},
|
|
19820
19930
|
{
|
|
19821
19931
|
"name": "range",
|
|
19822
19932
|
"type": "boolean",
|
|
@@ -22422,6 +22532,13 @@
|
|
|
22422
22532
|
"required": false,
|
|
22423
22533
|
"description": "The field name the tags post under."
|
|
22424
22534
|
},
|
|
22535
|
+
{
|
|
22536
|
+
"name": "optional",
|
|
22537
|
+
"type": "boolean",
|
|
22538
|
+
"required": false,
|
|
22539
|
+
"description": "Ends the label with (optional) when the field is not required. Required wins when both are set.",
|
|
22540
|
+
"default": false
|
|
22541
|
+
},
|
|
22425
22542
|
{
|
|
22426
22543
|
"name": "placeholder",
|
|
22427
22544
|
"type": "string",
|
|
@@ -23051,6 +23168,13 @@
|
|
|
23051
23168
|
"required": false,
|
|
23052
23169
|
"description": "The field name the time posts under."
|
|
23053
23170
|
},
|
|
23171
|
+
{
|
|
23172
|
+
"name": "optional",
|
|
23173
|
+
"type": "boolean",
|
|
23174
|
+
"required": false,
|
|
23175
|
+
"description": "Ends the label with (optional) when the field is not required. Required wins when both are set.",
|
|
23176
|
+
"default": false
|
|
23177
|
+
},
|
|
23054
23178
|
{
|
|
23055
23179
|
"name": "placeholder",
|
|
23056
23180
|
"type": "string",
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webority-web",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.122.0",
|
|
4
4
|
"platform": "Web",
|
|
5
5
|
"kitModuleVersion": 2,
|
|
6
6
|
"rendererProtocolVersion": 13,
|
|
7
7
|
"library": {
|
|
8
8
|
"name": "@webority/ui-react",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.122.0"
|
|
10
10
|
},
|
|
11
11
|
"files": {
|
|
12
12
|
"manifest.json": {
|
|
13
|
-
"sha256": "
|
|
14
|
-
"bytes":
|
|
13
|
+
"sha256": "63a8a0ae18863aefffdb1c1b44d7bc33189afa2d0e7040c6e09ed49d065c0c48",
|
|
14
|
+
"bytes": 863035
|
|
15
15
|
},
|
|
16
16
|
"kit.js": {
|
|
17
|
-
"sha256": "
|
|
18
|
-
"bytes":
|
|
17
|
+
"sha256": "179ef94960b9e572e4b8b112c4f9ac79846f6b425d741b4fa56910551971614b",
|
|
18
|
+
"bytes": 10939893
|
|
19
19
|
},
|
|
20
20
|
"kit.css": {
|
|
21
|
-
"sha256": "
|
|
22
|
-
"bytes":
|
|
21
|
+
"sha256": "13b14f71fb6ea024945f95cba617b4f1d49f44a65ba7c7ed05d2354805539ef6",
|
|
22
|
+
"bytes": 187355
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import r from"../lib/FieldMessage.js";import i from"./AppInfoTip.js";import a from"./AppRequiredMark.js";import o from"./useNodeLabels.js";import s,{optionsEqual as c}from"./useWuiControl.js";import{forwardRef as l,useEffect as u,useId as d,useRef as
|
|
1
|
+
import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import r from"../lib/FieldMessage.js";import i from"./AppInfoTip.js";import a from"./AppRequiredMark.js";import o from"./useNodeLabels.js";import s,{optionsEqual as c}from"./useWuiControl.js";import{forwardRef as l,useEffect as u,useId as d,useLayoutEffect as f,useRef as p}from"react";import{jsx as m,jsxs as h}from"react/jsx-runtime";import"@webority/ui-elements/elements/autocomplete";var g=[`sm`,`lg`],_=[],ee=(e,t)=>({...e,label:t}),v=(e,t,n)=>{if(n==null||t==null||t===``)return e;let r=String(t);return e.some(e=>String(e.value)===r)?e:[...e,{value:r,label:n}]},y=l(function(l,y){let{marker:b,props:x}=e(`AppAutocomplete`,l),{value:S,onChange:C,options:w,valueLabel:T,loadOptions:E,placeholder:D=`Search…`,minChars:O,debounce:k,disabled:A=!1,open:te,size:j,allowCustom:M=!1,name:N,id:P,label:F,error:I,hint:L,required:R=!1,optional:z=!1,help:B,helpLabel:V=`More information`,fieldClassName:H=``,...U}=x;n(`AppAutocomplete`,U),t(`AppAutocomplete`,`size`,j,g);let W=typeof E==`function`,G=d(),K=P||G,{setRef:q,innerRef:J}=s({ref:y,value:S??``,on:{change:e=>C?.(e.currentTarget.value,{isCustom:!!e.detail?.isCustom})}}),Y=w||_,{portal:X,toElementOptions:Z}=o(Y),Q=p(!1),$=p(E);return f(()=>{$.current=E}),u(()=>{let e=J.current;if(!e||W&&Q.current)return;let t=Z(v(Y,S,T),ee);c(t,e.options)||(e.options=t)},[Y,W,J,Z,S,T]),u(()=>{let e=J.current;if(!e||!W||!Q.current)return;let t=e.options,n=v(t,S,T);n!==t&&(e.options=n)},[S,T,W,J]),u(()=>{let e=J.current;if(!e||!W)return;let t=0,n=null,r=async r=>{let i=++t;n?.abort(),n=typeof AbortController==`function`?new AbortController:null,e.loading=!0;try{let a=await $.current(r.detail.query,{signal:n?.signal});i===t&&(Q.current=!0,e.options=a||[])}catch{i===t&&(Q.current=!0,e.options=[])}finally{i===t&&(e.loading=!1)}};return e.addEventListener(`search`,r),()=>{t=-1,n?.abort(),e.removeEventListener(`search`,r),e.loading=!1}},[W,J]),h(`div`,{...b,className:`field${H?` ${H}`:``}`,children:[F&&h(`label`,{className:`label`,htmlFor:K,children:[F,z&&!R&&m(`span`,{className:`label-optional`,children:` (optional)`}),R&&m(a,{}),B&&m(i,{label:V,children:B})]}),m(`wui-autocomplete`,{"aria-label":typeof F==`string`?F:void 0,"aria-describedby":I?`${K}-error`:L?`${K}-hint`:void 0,"aria-invalid":I?`true`:void 0,id:K,ref:q,name:N,placeholder:D,remote:W?``:void 0,"min-chars":O==null?void 0:String(O),debounce:k==null?void 0:String(k),size:j||void 0,"allow-custom":M?``:void 0,disabled:A?``:void 0,open:te?``:void 0,required:R?``:void 0,...U}),X,m(r,{error:I,hint:L,errorId:`${K}-error`,hintId:`${K}-hint`})]})});export{y as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{splitMarkerProps as e}from"../lib/wuiMarker.js";import{devWarn as t}from"../lib/devWarn.js";import n from"./warnInvalidValue.js";import r from"./warnUnknownProps.js";import{forwardRef as i,useCallback as a,useEffect as o,useLayoutEffect as s,useRef as c,useState as ee}from"react";import{jsx as l}from"react/jsx-runtime";var u=`wui-chart:select`,d=`wui-chart:legend-change`,te=`wui-chart:ready`,f=[`line`,`area`,`column`,`bar`,`donut`,`heatmap`,`calendar`,`funnel`,`gauge`,`waterfall`,`treemap`,`sankey`,`scatter`,`bubble`,`multiples`],ne=[`none`,`stacked`,`percent`],p=[`ready`,`loading`,`empty`,`error`],m=[`auto`,`svg`,`canvas`],h=[`chart`,`table`],
|
|
1
|
+
import{splitMarkerProps as e}from"../lib/wuiMarker.js";import{devWarn as t}from"../lib/devWarn.js";import n from"./warnInvalidValue.js";import r from"./warnUnknownProps.js";import{forwardRef as i,useCallback as a,useEffect as o,useLayoutEffect as s,useRef as c,useState as ee}from"react";import{jsx as l}from"react/jsx-runtime";var u=`wui-chart:select`,d=`wui-chart:legend-change`,te=`wui-chart:ready`,f=[`line`,`area`,`column`,`bar`,`donut`,`heatmap`,`calendar`,`funnel`,`gauge`,`waterfall`,`treemap`,`sankey`,`scatter`,`bubble`,`multiples`],ne=[`none`,`stacked`,`percent`],p=[`ready`,`loading`,`empty`,`error`],m=[`auto`,`svg`,`canvas`],h=[`chart`,`table`],re=`This chart couldn't load. Try again in a moment.`,g=()=>{try{return process.env.NODE_ENV!==`production`}catch{return!0}},_=!1;function v(){_||!g()||(_=!0,t("[@webority/ui-react] <AppChart> has no `title`, which names the chart for assistive tech and its exported files."))}var y=e=>e===``?void 0:e,b=e=>Array.isArray(e)?e.map(b):e==null||Object.getPrototypeOf(e)!==Object.prototype?e:Object.fromEntries(Object.entries(e).filter(([,e])=>e!==``).map(([e,t])=>[e,b(t)])),x=e=>({type:y(e.type),title:y(e.title),description:y(e.description),data:e.data,x:b(e.x),series:b(e.series),group:b(e.group),to:b(e.to),size:b(e.size),trend:e.trend,zoom:e.zoom,bands:b(e.bands),stack:y(e.stack),y:b(e.y),target:b(e.target),centerLabel:y(e.centerLabel),height:e.height>0?e.height:void 0,state:y(e.state),emptyText:y(e.emptyText),errorText:y(e.errorText),renderer:y(e.renderer)}),S=(e,t)=>t!=null&&Object.keys(e).every(n=>Object.is(e[n],t[n])),C=e=>{try{return JSON.stringify(e)}catch{return null}},w=i(function(i,g){let{marker:_,props:y}=e(`AppChart`,i),{type:b,title:w,description:T,data:E,x:D,series:O,group:k,to:A,size:j,trend:M,zoom:N,bands:P,stack:F,y:I,target:L,centerLabel:R,height:z,state:B,emptyText:V,errorText:H,renderer:U,view:W,onSelect:G,onLegendChange:K,onReady:q,className:J=``,style:Y,...X}=y;r(`AppChart`,X),n(`AppChart`,`type`,b,f),n(`AppChart`,`stack`,F,ne),n(`AppChart`,`state`,B,p),n(`AppChart`,`renderer`,U,m),n(`AppChart`,`view`,W,h),w||v();let Z=c(null),Q=c({props:null,signature:null}),$=c({onSelect:G,onLegendChange:K,onReady:q}),[ie,ae]=ee(!1),oe=a(e=>{Z.current=e,typeof g==`function`?g(e):g&&(g.current=e)},[g]);return o(()=>{$.current={onSelect:G,onLegendChange:K,onReady:q}}),s(()=>{let e=Z.current;if(!e)return;let t={type:b,title:w,description:T,data:E,x:D,series:O,group:k,to:A,size:j,trend:M,zoom:N,bands:P,stack:F,y:I,target:L,centerLabel:R,height:z,state:B,emptyText:V,errorText:H,renderer:U};if(S(t,Q.current.props))return;Q.current.props=t;let n=x(t),r=C(n);r!==null&&r===Q.current.signature||(Q.current.signature=r,e.spec=n)}),o(()=>{let e=Z.current,t=e=>t=>$.current[e]?.(t.detail),n=[[u,t(`onSelect`)],[d,t(`onLegendChange`)],[te,t(`onReady`)]];for(let[t,r]of n)e.addEventListener(t,r);return()=>{for(let[t,r]of n)e.removeEventListener(t,r)}},[]),o(()=>{let e=!0;return import(`@webority/ui-elements/chart`).catch(n=>{t(`[AppChart] the chart failed to load:`,n?.message),e&&ae(!0)}),()=>{e=!1}},[]),ie?l(`div`,{..._,className:J||void 0,style:Y,role:`status`,children:l(`p`,{className:`wui-chart-state-text`,children:H||re})}):l(`wui-chart`,{ref:oe,view:W||void 0,className:J||void 0,style:Y,..._,...X})});export{w as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import r from"../lib/FieldMessage.js";import i from"./AppRequiredMark.js";import{useId as a}from"react";import{jsx as o,jsxs as s}from"react/jsx-runtime";var c=[`sm`,`md`,`lg`];function l(l){let{marker:u,props:d}=e(`AppColorField`,l),{value:f=`#000000`,onChange:p,label:m,required:h=!1,
|
|
1
|
+
import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import r from"../lib/FieldMessage.js";import i from"./AppRequiredMark.js";import{useId as a}from"react";import{jsx as o,jsxs as s}from"react/jsx-runtime";var c=[`sm`,`md`,`lg`];function l(l){let{marker:u,props:d}=e(`AppColorField`,l),{value:f=`#000000`,onChange:p,label:m,required:h=!1,optional:g=!1,error:_,hint:v,name:y,id:b,disabled:x=!1,size:S=`md`,className:C=``,fieldClassName:w=``,...T}=d;n(`AppColorField`,T),t(`AppColorField`,`size`,S,c);let E=a(),D=b||E,O=_?`${D}-error`:v?`${D}-hint`:void 0,k=e=>/^#[0-9a-f]{6}$/i.test(e),A=S===`sm`?` color-field-sm`:S===`lg`?` color-field-lg`:``,j=S===`sm`?` input-sm`:S===`lg`?` input-lg`:``;return s(`div`,{...u,className:`field${w?` ${w}`:``}`,children:[m&&s(`label`,{className:`label`,htmlFor:D,children:[m,g&&!h&&o(`span`,{className:`label-optional`,children:` (optional)`}),h&&o(i,{})]}),s(`div`,{className:`color-field${A}`,children:[o(`input`,{type:`color`,className:`color-field-swatch`,value:k(f)?f:`#000000`,onChange:e=>p?.(e.target.value),disabled:x,"aria-label":`${m||`Colour`}, colour picker`,tabIndex:-1}),o(`input`,{type:`text`,className:`input color-field-hex${j}${_?` error`:``}${C?` ${C}`:``}`,id:D,name:y,value:f,onChange:e=>p?.(e.target.value),placeholder:`#4F46E5`,spellCheck:!1,maxLength:7,required:h,disabled:x,"aria-invalid":_?`true`:`false`,"aria-describedby":O,...T})]}),o(r,{error:_,hint:v,errorId:`${D}-error`,hintId:`${D}-hint`})]})}export{l as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./
|
|
1
|
+
import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./AppDropdown.js";import{jsx as n,jsxs as r}from"react/jsx-runtime";function i(i){let{marker:a,props:o}=e(`AppColumnMenu`,i),{columns:s,hiddenColumns:c=[],onToggle:l,label:u=`Columns`,className:d=``,...f}=o,p=s.filter(e=>e.hideable);return r(t,{icon:`layout-grid`,label:u,menuClassName:`wui-column-menu${d?` ${d}`:``}`,...a,...f,children:[n(`div`,{className:`wui-column-menu-title`,children:u}),p.map(e=>r(`label`,{className:`wui-column-menu-item`,children:[n(`input`,{type:`checkbox`,className:`wui-check`,checked:!c.includes(e.key),onChange:()=>l(e.key)}),e.label]},e.key))]})}export{i as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import r from"./
|
|
1
|
+
import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import r from"./AppIcon.js";import i from"./AppButton.js";import a from"./AppModal.js";import o from"./AppInput.js";import{MODAL_ICONS as s}from"./ModalIcons.js";import{useEffect as c,useState as l}from"react";import{Fragment as u,jsx as d,jsxs as f}from"react/jsx-runtime";var p=[`sm`,`md`,`lg`,`xl`],m=[`default`,`plain`];function h(h){let{marker:g,props:_}=e(`AppConfirmDialog`,h),{open:v,title:y,variant:b=`default`,message:x,confirmLabel:S=`Confirm`,cancelLabel:C=`Cancel`,danger:w=!1,tone:T,image:E,icon:D,iconSize:O,confirmPhrase:k,onConfirm:A,onClose:j,loading:M=!1,staticBackdrop:N=!1,placement:P=`center`,size:F=`md`,className:I=``,children:L,...R}=_;n(`AppConfirmDialog`,R),t(`AppConfirmDialog`,`tone`,T,Object.keys(s)),t(`AppConfirmDialog`,`size`,typeof F==`string`?F:null,p),t(`AppConfirmDialog`,`variant`,b,m);let[z,B]=l(``);if(c(()=>{v||B(``)},[v]),!v)return null;let V=!!k&&z.trim()!==k,H=b===`plain`,U=H?`sm`:`md`,W=H||E||D?null:s[T||(w?`delete`:`info`)],G=O>0?{"--wui-confirm-icon-size":`${O}px`}:void 0,K=()=>{M||j?.()};return d(a,{...g,...R,open:v,hideHeader:!0,title:y,onClose:K,staticBackdrop:N,placement:P,size:F,className:[`wui-confirm`,H&&`wui-confirm-plain`,I].filter(Boolean).join(` `),footer:f(`div`,{className:`wui-confirm-actions`,children:[d(i,{variant:H?`light`:`secondary`,size:U,disabled:M,onClick:K,children:C}),d(i,{variant:w?`danger`:`primary`,size:U,disabled:V,loading:M,onClick:A,children:S})]}),children:f(`div`,{className:`wui-confirm-content`,children:[!H&&E?d(`span`,{className:`wui-confirm-icon`,style:G,children:d(`img`,{src:E,alt:``,"aria-hidden":`true`})}):!H&&D?d(`span`,{className:`wui-confirm-icon`,style:G,children:typeof D==`string`?d(r,{name:D,size:80}):D}):W&&d(`span`,{className:`wui-confirm-icon`,style:G,children:d(W,{size:120})}),d(`h3`,{className:`wui-confirm-title`,tabIndex:-1,"data-autofocus":``,children:y}),x&&d(`p`,{className:`wui-confirm-msg`,children:x}),L!=null&&L!==!1&&d(`div`,{className:`wui-confirm-body`,children:L}),k&&d(o,{fieldClassName:`mt-3 mb-0 w-100 text-start`,label:f(u,{children:[`Type `,d(`strong`,{children:k}),` to confirm`]}),value:z,onChange:e=>B(e.target.value),"aria-label":`Type ${k} to confirm`,disabled:M})]})})}export{h as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"./AppConfirmDialog.js";import{createContext as t,useCallback as n,useContext as r,useEffect as i,useRef as a,useState as o}from"react";import{jsx as s,jsxs as c}from"react/jsx-runtime";var l=t(null);function u(t){let{children:r}=t,[u,d]=o(null),[f,p]=o(!1),m=a(null),h=n((e={})=>new Promise(t=>{m.current?.(!1),m.current=t,d({...e,title:e.title||`Are you sure?`})}),[]),g=e=>{m.current?.(e),m.current=null,p(!1),d(null)};return i(()=>()=>m.current?.(!1),[]),c(l.Provider,{value:h,children:[r,s(e,{open:!!u,title:u?.title,message:u?.message,confirmLabel:u?.confirmLabel,cancelLabel:u?.cancelLabel,danger:u?.danger,tone:u?.tone,icon:u?.icon,confirmPhrase:u?.confirmPhrase,loading:f,onConfirm:async()=>{let e=u?.onRun;if(typeof e!=`function`){g(!0);return}p(!0);try{await e(),g(!0)}catch{p(!1)}},onClose:()=>g(!1)})]})}function d(){let e=r(l);if(!e)throw Error(`useConfirm needs an <AppConfirmProvider> above it.`);return e}export{u as default,d as useConfirm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{splitMarkerProps as e}from"../lib/wuiMarker.js";import{devWarn as t}from"../lib/devWarn.js";import n from"./warnUnknownProps.js";import{
|
|
1
|
+
import{splitMarkerProps as e}from"../lib/wuiMarker.js";import{devWarn as t}from"../lib/devWarn.js";import n from"./warnUnknownProps.js";import{loadFlagStyles as r}from"../lib/flagStyles.js";import{useEffect as i}from"react";import{jsx as a}from"react/jsx-runtime";function o(o){let{marker:s,props:c}=e(`AppCountryFlag`,o),{country:l,label:u,className:d=``,...f}=c;n(`AppCountryFlag`,f),i(()=>{r()},[]);let p=String(l??``).trim().toLowerCase();if(!/^[a-z]{2}$/.test(p))return t(`[@webority/ui-react] AppCountryFlag: country must be a two-letter ISO 3166-1 code, got`,l),null;let m=typeof u==`string`&&u.trim().length>0;return a(`span`,{className:[`wui-flag`,`wui-flag-${p}`,d].filter(Boolean).join(` `),...m?{role:`img`,"aria-label":u}:{"aria-hidden":`true`},...s,...f})}export{o as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import r from"../lib/FieldMessage.js";import i from"./AppInfoTip.js";import a from"./AppRequiredMark.js";import o from"./useWuiControl.js";import{cloneElement as
|
|
1
|
+
import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import r from"../lib/FieldMessage.js";import i from"./AppInfoTip.js";import a from"./AppRequiredMark.js";import o from"./useWuiControl.js";import{loadFlagStyles as s}from"../lib/flagStyles.js";import{cloneElement as c,forwardRef as l,useEffect as u,useId as d}from"react";import{jsx as f,jsxs as p}from"react/jsx-runtime";import"@webority/ui-elements/elements/country-select";var m=[`sm`,`md`,`lg`],h=[`off`,`border`],g=l(function(l,g){let{marker:_,props:v}=e(`AppCountrySelect`,l),{value:y,onChange:b,countries:x,placeholder:S=`Select country`,searchPlaceholder:C=`Search countries...`,searchable:w=!0,clearable:T=!1,size:E=`md`,floatingLabel:D=`off`,disabled:O,open:k,label:A,required:j=!1,optional:M=!1,error:N,hint:P,help:F,helpLabel:I=`More information`,id:L,name:R,className:z=``,fieldClassName:B=``,"aria-label":V,"aria-labelledby":H,"aria-describedby":U,...W}=v;n(`AppCountrySelect`,W),t(`AppCountrySelect`,`size`,E,m),t(`AppCountrySelect`,`floatingLabel`,D,h),u(()=>{s()},[]);let G=d(),{setRef:K}=o({ref:g,value:y??``,onChange:b}),q=L||G,J=D!==`off`&&A,Y=N&&q?`${q}-error`:void 0,X=P&&q?`${q}-hint`:void 0,Z=f(`wui-country-select`,{"aria-label":V||(typeof A==`string`?A:void 0),"aria-labelledby":H||void 0,"aria-describedby":Y||X||U||void 0,"aria-invalid":N?`true`:void 0,ref:K,id:q,name:R,countries:Array.isArray(x)?x.join(`,`):void 0,placeholder:J?` `:S,"search-placeholder":C,searchable:w?``:void 0,clearable:T?``:void 0,size:E===`sm`||E===`lg`?E:void 0,disabled:O?``:void 0,open:k?``:void 0,required:j?``:void 0,className:z||void 0,...W});if(!A&&!N&&!P)return c(Z,_);let Q=[`field`,B].filter(Boolean).join(` `);return p(`div`,{..._,className:Q,children:[A&&!J&&p(`label`,{className:`label`,htmlFor:q,children:[A,M&&!j&&f(`span`,{className:`label-optional`,children:` (optional)`}),j&&f(a,{}),F&&f(i,{label:I,children:F})]}),J?p(`div`,{className:`field-float`,children:[Z,p(`label`,{className:`float-label`,htmlFor:q,children:[A,M&&!j&&f(`span`,{className:`label-optional`,children:` (optional)`}),j&&f(a,{})]})]}):Z,f(r,{error:N,hint:P,errorId:Y,hintId:X})]})});export{g as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{splitMarkerProps as e}from"../lib/wuiMarker.js";import{devWarn as t}from"../lib/devWarn.js";import n from"./warnInvalidValue.js";import r from"./warnUnknownProps.js";import i from"./AppIcon.js";import{AppSkeletonRows as a}from"./AppSkeleton.js";import o from"./AppTablePagination.js";import{attachRowDrag as s,attachScrollEdges as c,syncTargets as l}from"@webority/ui-elements/helpers";import{Children as u,Fragment as ee,useEffect as d,useLayoutEffect as f,useMemo as te,useRef as p,useState as m}from"react";import{Fragment as ne,jsx as h,jsxs as g}from"react/jsx-runtime";import{FORCED_STATE_CLASSES as re}from"@webority/theme/runtime";import{COLUMN_MAX_WIDTH as ie,COLUMN_MIN_WIDTH as ae,DATA_TABLE_TEXT as oe,PIN_AT_VAR as se,PIN_SIDES as ce,ROW_HEIGHTS as le,ROW_MOVE_LIMIT as ue,ROW_SAVE_ERROR_CLASS as de,groupCount as fe,groupItems as pe,measureRows as me,pinAtValue as he,pinClasses as ge,planPins as _e,playRowMoves as ve,rowOrderChanged as ye,saveOutcomeText as be,settledRows as xe,virtualRange as Se}from"@webority/ui-elements/elements/data-table";var Ce=[`comfortable`,`cozy`,`compact`],we=[`auto`,`fixed`],Te=()=>{try{return process.env.NODE_ENV!==`production`}catch{return!0}},_=new Set;function v(e,n){_.has(e)||!Te()||(_.add(e),t(`[@webority/ui-react] <AppDataTable> ${n}`))}var Ee=100,De=e=>e.id,Oe=(e,t,n)=>{let r=!!t?.(e),i=r?``:n?.(e)||``;return{state:r?`saving`:i?`error`:null,message:i}};function ke(e){return e===`end`?`wui-cell-end`:e===`num`?`num`:e===`center`?`text-center`:``}function Ae(e){return e==null||e===``?`-`:Array.isArray(e)?u.toArray(e):typeof e==`boolean`?String(e):e}function je(e){if(!e||!(e.total>0))return!1;let t=e.pageSizes?.length?e.pageSizes:[e.pageSize];return e.total>Math.min(...t)}function y(t){let{marker:u,props:Te}=e(`AppDataTable`,t),{columns:_,rows:y,rowKey:b=De,sort:Me,onSort:x,loading:S=!1,skeletonRows:Ne=5,empty:Pe=`No records found.`,emptyFiltered:Fe,sourceCount:Ie,rowActions:C,rowActionsLabel:Le,pagination:w,ariaLabel:Re,className:ze=``,wrapperClassName:Be=``,selectable:T=!1,selectedIds:E,isRowSelectable:D,onToggleRow:Ve,onToggleAll:He,onSelectRange:Ue,renderExpanded:We,density:O=`comfortable`,tableLayout:Ge=`auto`,striped:Ke=!1,flush:qe=!1,pad:Je,headerTone:Ye,rowDrag:k=!1,maxHeight:Xe,stickyFirstColumn:Ze=!1,stickyActions:Qe=!1,stackOnMobile:A=!1,hiddenColumns:$e,rowStatus:et,rowHref:j,onRowClick:tt,activeRowKey:nt,hoverRowKey:rt,resizableColumns:M=!1,viewKey:it,groupBy:N,groupLabel:at,virtual:P=!1,rowSaving:F,rowSaveError:I,...ot}=Te;r(`AppDataTable`,ot);let{style:st,...ct}=ot,lt=$e?.length?new Set($e):null;_=lt?_.filter(e=>!(e.hideable&<.has(e.key))):_,n(`AppDataTable`,`density`,O,Ce),n(`AppDataTable`,`tableLayout`,Ge,we);for(let e of _)n(`AppDataTable`,`column.pin`,e.pin,ce);let ut=[`table table-ledger`,O===`cozy`||O===`compact`?`wui-table-${O}`:``,Ke?`wui-table-striped`:``,Ze?`wui-table-sticky-first`:``,Qe?`wui-table-sticky-actions`:``,A?`wui-table-stack`:``,ze].filter(Boolean).join(` `),L=typeof We==`function`,[dt,ft]=m(()=>new Set),pt=e=>ft(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),mt=_.some(e=>typeof e.footer==`function`),R=typeof j==`function`||typeof tt==`function`,ht=e=>!!e.target.closest(`a, button, input, select, textarea, label, [role='menu'], [role='menuitem'], .dropdown`),gt=(e,t)=>{if(ht(t)||(tt&&tt(e),!j))return;let n=j(e);n&&(t.ctrlKey||t.metaKey||t.button===1?window.open(n,`_blank`,`noopener`):window.location.assign(n))},z=Xe!==void 0,_t=[`table-wrap`,z?`wui-table-scroll`:``,qe?`wui-table-flush`:``,Be].filter(Boolean).join(` `),vt={maxHeight:z?Xe:void 0,"--wui-table-pad":Je!=null&&!qe?`${Je}px`:void 0,"--wui-table-header-bg":Ye??void 0},yt=Object.values(vt).some(e=>e!==void 0)||st!==void 0?{...vt,...st}:void 0,B=Math.max(1,_.length+ +!!C+ +!!T+ +!!L),bt=_.some(e=>e.pin===`start`||e.pin===`end`),V=bt||M||!!N||P,H=+!!L+ +!!T,xt=bt?_e([...L?[`lead`]:[],...T?[`lead`]:[],..._.map(e=>e.pin===`start`||e.pin===`end`?e.pin:null),...C?[null]:[]]):[],U=(e,t=``)=>{let n=xt[e];return n?{className:`${t.trim()} ${ge(n)}`.trim(),style:{[se]:he(n.side,n.ordinal)}}:{className:t,style:void 0}},St=(e,t)=>xt[e]?{...t,...U(e).style}:t,Ct=_.length-1+ +!!C;it&&!M&&v(`view-key`,"`viewKey` remembers resized widths: add `resizableColumns`."),P&&!z&&v(`virtual-height`,"`virtual` needs `maxHeight`: without a scroll box every row renders."),P&&(L||A)&&v(`virtual-shape`,"`virtual` takes rows of one height, so it is off with `renderExpanded` or `stackOnMobile`."),!P&&y?.length>500&&v(`rows-without-virtual`,`renders more than 500 rows without virtual: add virtual with maxHeight, or page the data.`);let W=P&&z&&!L&&!A&&!S&&y?.length>0,G=(e,t)=>!D||!!D(e,t),wt=T&&y?y.reduce((e,t,n)=>e+ +!!G(t,n),0):0,K=T&&y?y.reduce((e,t,n)=>e+(G(t,n)&&E?.has(b(t,n))?1:0),0):0,Tt=wt>0&&K===wt,Et=K>0&&!Tt,Dt=e=>{e&&(e.indeterminate=Et)},Ot=p(null),kt=(e,t)=>{let n=Ot.current;Ot.current=e;let r=t&&n!==null?y.findIndex((e,t)=>b(e,t)===n):-1,i=y.findIndex((t,n)=>b(t,n)===e);if(r<0||i<0||r===i){Ve?.(e);return}let a=!E?.has(e),o=Math.min(r,i),s=y.slice(o,Math.max(r,i)+1).map((e,t)=>[e,o+t]).filter(([e,t])=>G(e,t)).map(([e,t])=>b(e,t)).filter(e=>(E?.has(e)||!1)!==a);if(Ue)Ue(s,a);else for(let e of s)Ve?.(e)},At=e=>{if(!D){He?.(e);return}(y||[]).forEach((t,n)=>{let r=b(t,n);G(t,n)&&(E?.has(r)||!1)!==e&&Ve?.(r)})},[jt,Mt]=m(()=>new Set),Nt=e=>Mt(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),q=te(()=>{let e=(y||[]).map((e,t)=>({row:e,i:t}));return N?pe(e,({row:e})=>String(e[N]??``)).flatMap(e=>[{group:e,open:!jt.has(e.key)},...jt.has(e.key)?[]:e.items]):e},[y,N,jt]),J=p(null),Pt=p(null);d(()=>{let e=J.current;if(!e)return;let t=e=>{let t=e.target.closest?.(`.u-name`);t&&!t.title&&(t.scrollWidth>t.clientWidth||t.scrollHeight>t.clientHeight)&&(t.title=t.textContent.trim())},n=e=>{let t=e.target.closest?.(`tbody > tr[aria-rowindex]`)?.getAttribute(`aria-rowindex`);Pt.current=t?Number(t)-2:null},r=t=>{e.contains(t.relatedTarget)||(Pt.current=null)};e.addEventListener(`mouseover`,t),e.addEventListener(`focusin`,t),e.addEventListener(`focusin`,n),e.addEventListener(`focusout`,r);let i=c(e);return()=>{e.removeEventListener(`mouseover`,t),e.removeEventListener(`focusin`,t),e.removeEventListener(`focusin`,n),e.removeEventListener(`focusout`,r),i()}},[V]),d(()=>{if(!k||!J.current)return;let e=s(J.current);return l(document),e},[k,V]);let Ft=p(!1);d(()=>{!Ft.current&&(Ft.current=!0,K===0)||J.current?.querySelector(`table`)?.dispatchEvent(new CustomEvent(`selectionchange`,{bubbles:!0,detail:{selected:K,total:y?.length??0,keys:y?y.flatMap((e,t)=>{let n=b(e,t);return G(e,t)&&E?.has(n)?[String(n)]:[]}):[]}}))},[T,K]);let[It,Lt]=m({top:0,height:0}),[Y,Rt]=m(le[O]??le.comfortable);d(()=>{let e=J.current;if(!W||!e)return;let t=0,n=()=>{t=0;let n=e.querySelector(`:scope > table > thead`)?.getBoundingClientRect().height||0,r={top:Math.max(0,e.scrollTop-n),height:e.clientHeight};Lt(e=>e.top===r.top&&e.height===r.height?e:r)},r=()=>{t||=requestAnimationFrame(n)};e.addEventListener(`scroll`,r,{passive:!0});let i=typeof ResizeObserver<`u`?new ResizeObserver(r):null;return i?.observe(e),n(),()=>{e.removeEventListener(`scroll`,r),i?.disconnect(),t&&cancelAnimationFrame(t)}},[W,V]),f(()=>{if(!W)return;let e=(J.current?.querySelector(`:scope > table > tbody > tr:not(.wui-virtual-spacer, .wui-group-row)`))?.getBoundingClientRect().height;e>0&&Math.abs(e-Y)>.5&&Rt(e)},[O,y?.length,P,W]);let X={start:0,end:q.length,before:0,after:0};if(W){X=Se({scrollTop:It.top,viewport:It.height||Number.parseFloat(Xe)||0,rowHeight:Y,count:q.length});let e=Pt.current;e!==null&&e>=0&&e<q.length&&(e<X.start&&X.start-e<=Ee&&(X={...X,start:e,before:e*Y}),e>=X.end&&e-X.end<Ee&&(X={...X,end:e+1,after:(q.length-e-1)*Y}))}let zt=p(null),Bt=p(null),Vt=p(null),Ht=!P&&!S&&y?.length>0&&y.length<=ue;f(()=>{let e=zt.current;if(!Ht||!e){Bt.current=null,Vt.current=null;return}let t=y.map((e,t)=>b(e,t));ye(Vt.current,t)&&ve(e.rows,Bt.current),Bt.current=me(e.rows),Vt.current=t});let Ut=typeof F==`function`||typeof I==`function`,Z=p(null),Wt=p(null);d(()=>{if(!Ut){Wt.current=null;return}let e=_[0]?.key,t=new Map;(y||[]).forEach((n,r)=>{let i=e===void 0?void 0:n[e],a=typeof i==`string`||typeof i==`number`?String(i):``;t.set(b(n,r),{...Oe(n,F,I),label:a})});let n=be(xe(Wt.current,t));Wt.current=t,n&&Z.current&&(Z.current.textContent=n)},[y,F,I,b]);let Gt=Fe!==void 0&&(Ie===void 0||Ie>0)?Fe:Pe,Kt=({group:e,open:t},n)=>{let r=e.items[0].row[N],a=e.items.map(e=>e.row);return h(`tr`,{className:`wui-group-row`,"data-group-key":e.key,"aria-rowindex":W?n+2:void 0,children:h(`th`,{className:`wui-group-cell`,scope:`rowgroup`,colSpan:B,children:g(`button`,{type:`button`,className:`wui-group-toggle`,"aria-expanded":t,onClick:()=>Nt(e.key),children:[h(i,{name:`chevron-down`,size:16}),h(`span`,{className:`wui-group-label`,children:at?at(r,a):Ae(r)}),h(`span`,{className:`wui-group-count`,"aria-hidden":`true`,children:fe(e.items.length)}),h(`span`,{className:`visually-hidden wui-group-rows`,children:`, ${oe.rows(e.items.length)}`})]})})},`group:${e.key}`)},qt=({row:e,i:t},n)=>{let r=b(e,t),a=L&&dt.has(r),o=nt!=null&&String(nt)===String(r),s=rt!=null&&String(rt)===String(r),c=String(r).replace(/[^a-z0-9]/gi,`_`),l=U(0,`wui-expand-cell`),u=U(+!!L,`wui-select-cell`),d=Ut?Oe(e,F,I):null,f=G(e,t);return g(ee,{children:[g(`tr`,{className:[T&&f&&E?.has(r)?`is-selected`:``,R?`wui-row-link`:``,o?`wui-row-active`:``,s?re.hover:``].filter(Boolean).join(` `)||void 0,"aria-current":o?`true`:void 0,"aria-rowindex":W?n+2:void 0,"aria-busy":d?.state===`saving`?`true`:void 0,"data-wui-save-state":d?.state||void 0,"data-status":et?.(e)||void 0,"data-href":j?.(e)||void 0,"data-row-key":k?String(r):void 0,tabIndex:R?0:void 0,onClick:R?t=>gt(e,t):void 0,onAuxClick:R&&j?t=>t.button===1&>(e,t):void 0,onKeyDown:R?t=>{t.key===`Enter`&&t.target===t.currentTarget&>(e,t)}:void 0,children:[L&&h(`td`,{className:l.className,style:l.style,children:h(`button`,{type:`button`,className:`wui-expand-toggle${a?` is-open`:``}`,"aria-expanded":a,"aria-controls":a?`${c}-expanded`:void 0,"aria-label":a?`Collapse row`:`Expand row`,onClick:()=>pt(r),children:h(i,{name:`chevron-down`,size:16})})}),T&&h(`td`,{className:u.className,style:u.style,children:h(`input`,{type:`checkbox`,className:`wui-check`,checked:f&&(E?.has(r)||!1),disabled:!f,onChange:e=>kt(r,e.nativeEvent.shiftKey),onMouseDown:e=>{e.shiftKey&&e.preventDefault()},"aria-label":`Select row`})}),_.map((t,n)=>g(`td`,{className:U(H+n,(n===0?`wui-name-cell `:``)+(t.nowrap?`text-nowrap `:``)+ke(t.align)+(t.cellClassName?` ${t.cellClassName}`:``)).className,style:St(H+n,t.cellStyle),"data-label":A&&typeof t.label==`string`?t.label:void 0,children:[t.render?t.render(e):Ae(e[t.key]),n===0&&d?.state===`error`&&h(`span`,{className:de,children:d.message})]},t.key)),C&&h(`td`,{children:h(`div`,{className:`u-row-actions`,children:C(e)})})]}),a&&h(`tr`,{className:`wui-row-expanded`,children:h(`td`,{id:`${c}-expanded`,colSpan:B,children:We(e)})})]},r)},Jt=(e,t)=>e.group?Kt(e,t):qt(e,t),Yt=(e,t)=>W?h(`tr`,{className:`wui-virtual-spacer`,"aria-hidden":`true`,hidden:t===0,children:h(`td`,{colSpan:B,style:{height:t}})},e):null,Q=U(0,`wui-expand-cell`),$=U(+!!L,`wui-select-cell`);return g(ne,{children:[g(V?`wui-data-table`:`div`,{ref:J,...V?{class:_t,resizable:M?``:void 0,"view-key":it||void 0,"data-wui-row-drag":k?``:void 0}:{className:_t,"data-wui-row-drag":k?``:void 0},style:yt,tabIndex:0,...u,...ct,children:[g(`table`,{className:ut,"aria-label":Re,"aria-rowcount":W?q.length+1:void 0,style:Ge===`fixed`?{tableLayout:`fixed`}:void 0,children:[h(`thead`,{children:g(`tr`,{"aria-rowindex":W?1:void 0,children:[L&&h(`th`,{className:Q.className,style:Q.style,children:h(`span`,{className:`visually-hidden`,children:`Expand`})}),T&&h(`th`,{className:$.className,style:$.style,children:h(`input`,{ref:Dt,type:`checkbox`,className:`wui-check`,checked:Tt,onChange:e=>At(e.target.checked),"aria-label":`Select all rows`})}),_.map((e,t)=>{let n=!!(e.sortable&&x),r=Me&&Me.key===e.key,a=e.align===`num`||e.align===`end`,o=n&&h(`span`,{className:`sort-icon${a?` wui-sort-lead`:``}`,children:h(i,{name:`chevrons-up-down`,size:14})}),s=M&&t!==Ct,c=e.width||e.minWidth?{width:e.width,minWidth:e.minWidth}:void 0;return g(`th`,{className:U(H+t,(n?`sortable `:``)+(t===0?`wui-name-cell `:``)+(e.nowrap?`text-nowrap `:``)+(e.grow?`wui-col-grow `:``)+(s?`wui-col-resizable `:``)+ke(e.align)).className,style:St(H+t,c),"data-key":V?e.key:void 0,"aria-label":s&&typeof e.label==`string`?e.label:void 0,"data-pin":e.pin===`start`||e.pin===`end`?e.pin:void 0,tabIndex:n?0:void 0,"aria-sort":r?Me.dir===`asc`?`ascending`:`descending`:n?`none`:void 0,onClick:n?()=>x(e.key):void 0,onKeyDown:n?t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),x(e.key))}:void 0,children:[a&&o,e.label,!a&&o,s&&h(`span`,{className:`wui-col-resize`,role:`separator`,"aria-orientation":`vertical`,"aria-valuemin":ae,"aria-valuemax":ie,tabIndex:0,"aria-label":oe.resize(typeof e.label==`string`?e.label:e.key)})]},e.key)}),C&&(Le?h(`th`,{className:`wui-cell-end`,children:Le}):h(`th`,{className:`wui-cell-end`,children:h(`span`,{className:`visually-hidden`,children:`Actions`})}))]})}),h(`tbody`,{ref:zt,children:S?h(a,{rows:Ne,cols:B}):y?.length?g(ne,{children:[Yt(`before`,X.before),q.slice(X.start,X.end).map((e,t)=>Jt(e,X.start+t)),Yt(`after`,X.after)]}):null}),mt&&!S&&y?.length>0&&h(`tfoot`,{children:g(`tr`,{children:[L&&h(`td`,{className:Q.className,style:Q.style}),T&&h(`td`,{className:$.className,style:$.style}),_.map((e,t)=>h(`td`,{className:U(H+t,(t===0?`wui-name-cell `:``)+(e.nowrap?`text-nowrap `:``)+ke(e.align)).className,style:St(H+t,void 0),children:e.footer?e.footer(y):null},e.key)),C&&h(`td`,{})]})})]}),!S&&!y?.length&&h(`div`,{className:`tbl-empty-block`,children:typeof Gt==`string`?h(`div`,{className:`tbl-empty-plain`,children:Gt}):Gt})]}),je(w)&&h(o,{page:w.page,totalPages:w.totalPages,pageSize:w.pageSize,onPageChange:w.setPage,onPageSizeChange:w.setPageSize,pageSizes:w.pageSizes,mode:w.mode}),Ut&&h(`div`,{ref:Z,className:`visually-hidden`,role:`status`,"aria-live":`polite`,"data-wui-table-status":``})]})}export{y as default};
|
|
1
|
+
import{splitMarkerProps as e}from"../lib/wuiMarker.js";import{devWarn as t}from"../lib/devWarn.js";import n from"./warnInvalidValue.js";import r from"./warnUnknownProps.js";import i from"./AppIcon.js";import a from"./AppSkeleton.js";import o from"./AppTablePagination.js";import{attachRowDrag as s,attachScrollEdges as c,syncTargets as ee}from"@webority/ui-elements/helpers";import{Children as l,Fragment as te,useEffect as u,useLayoutEffect as d,useMemo as ne,useRef as f,useState as p}from"react";import{Fragment as re,jsx as m,jsxs as h}from"react/jsx-runtime";import{FORCED_STATE_CLASSES as ie}from"@webority/theme/runtime";import{COLUMN_MAX_WIDTH as ae,COLUMN_MIN_WIDTH as oe,DATA_TABLE_TEXT as se,PIN_AT_VAR as ce,PIN_SIDES as le,ROW_HEIGHTS as ue,ROW_MOVE_LIMIT as de,ROW_SAVE_ERROR_CLASS as fe,groupCount as pe,groupItems as me,measureRows as he,pinAtValue as ge,pinClasses as _e,planPins as ve,playRowMoves as ye,rowOrderChanged as be,saveOutcomeText as xe,settledRows as Se,virtualRange as Ce}from"@webority/ui-elements/elements/data-table";var we=[`comfortable`,`cozy`,`compact`],Te=[`auto`,`fixed`],Ee=()=>{try{return process.env.NODE_ENV!==`production`}catch{return!0}},g=new Set;function _(e,n){g.has(e)||!Ee()||(g.add(e),t(`[@webority/ui-react] <AppDataTable> ${n}`))}var De=100,Oe=e=>e.id,ke=()=>{},Ae=(e,t,n)=>{let r=!!t?.(e),i=r?``:n?.(e)||``;return{state:r?`saving`:i?`error`:null,message:i}};function v(e){return e===`end`?`wui-cell-end`:e===`num`?`num`:e===`center`?`text-center`:``}function je(e){return e===`center`?`44%`:e===`end`||e===`num`?`56%`:`60%`}function Me(e){return e==null||e===``?`-`:Array.isArray(e)?l.toArray(e):typeof e==`boolean`?String(e):e}function Ne(e){if(!e||!(e.total>0))return!1;let t=e.pageSizes?.length?e.pageSizes:[e.pageSize];return e.total>Math.min(...t)}function y(t){let{marker:l,props:Ee}=e(`AppDataTable`,t),{columns:g,rows:y,rowKey:b=Oe,sort:x,onSort:S,loading:C=!1,skeletonRows:Pe=5,empty:Fe=`No records found.`,emptyFiltered:Ie,sourceCount:Le,rowActions:w,rowActionsLabel:Re,pagination:T,ariaLabel:ze,className:Be=``,wrapperClassName:Ve=``,selectable:E=!1,selectedIds:D,isRowSelectable:He,onToggleRow:Ue,onToggleAll:We,onSelectRange:Ge,renderExpanded:Ke,density:O=`comfortable`,tableLayout:qe=`auto`,striped:Je=!1,flush:Ye=!1,pad:Xe,headerTone:Ze,rowDrag:k=!1,maxHeight:Qe,stickyFirstColumn:$e=!1,stickyActions:et=!1,stackOnMobile:A=!1,hiddenColumns:tt,rowStatus:nt,rowHref:j,onRowClick:rt,activeRowKey:it,hoverRowKey:at,resizableColumns:M=!1,viewKey:ot,groupBy:N,groupLabel:st,virtual:P=!1,rowSaving:F,rowSaveError:I,...ct}=Ee;r(`AppDataTable`,ct);let{style:lt,...ut}=ct,dt=tt?.length?new Set(tt):null;g=dt?g.filter(e=>!(e.hideable&&dt.has(e.key))):g,n(`AppDataTable`,`density`,O,we),n(`AppDataTable`,`tableLayout`,qe,Te);for(let e of g)n(`AppDataTable`,`column.pin`,e.pin,le);let ft=[`table table-ledger`,O===`cozy`||O===`compact`?`wui-table-${O}`:``,Je?`wui-table-striped`:``,$e?`wui-table-sticky-first`:``,et?`wui-table-sticky-actions`:``,A?`wui-table-stack`:``,Be].filter(Boolean).join(` `),L=typeof Ke==`function`,[pt,mt]=p(()=>new Set),ht=e=>mt(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),gt=g.some(e=>typeof e.footer==`function`),R=typeof j==`function`||typeof rt==`function`,_t=e=>!!e.target.closest(`a, button, input, select, textarea, label, [role='menu'], [role='menuitem'], .dropdown`),vt=(e,t)=>{if(_t(t)||(rt&&rt(e),!j))return;let n=j(e);n&&(t.ctrlKey||t.metaKey||t.button===1?window.open(n,`_blank`,`noopener`):window.location.assign(n))},z=Qe!==void 0,yt=[`table-wrap`,z?`wui-table-scroll`:``,Ye?`wui-table-flush`:``,Ve].filter(Boolean).join(` `),bt={maxHeight:z?Qe:void 0,"--wui-table-pad":Xe!=null&&!Ye?`${Xe}px`:void 0,"--wui-table-header-bg":Ze??void 0},xt=Object.values(bt).some(e=>e!==void 0)||lt!==void 0?{...bt,...lt}:void 0,St=Math.max(1,g.length+ +!!w+ +!!E+ +!!L),Ct=g.some(e=>e.pin===`start`||e.pin===`end`),B=Ct||M||!!N||P,V=+!!L+ +!!E,wt=Ct?ve([...L?[`lead`]:[],...E?[`lead`]:[],...g.map(e=>e.pin===`start`||e.pin===`end`?e.pin:null),...w?[null]:[]]):[],H=(e,t=``)=>{let n=wt[e];return n?{className:`${t.trim()} ${_e(n)}`.trim(),style:{[ce]:ge(n.side,n.ordinal)}}:{className:t,style:void 0}},U=(e,t)=>wt[e]?{...t,...H(e).style}:t,Tt=g.length-1+ +!!w;ot&&!M&&_(`view-key`,"`viewKey` remembers resized widths: add `resizableColumns`."),P&&!z&&_(`virtual-height`,"`virtual` needs `maxHeight`: without a scroll box every row renders."),P&&(L||A)&&_(`virtual-shape`,"`virtual` takes rows of one height, so it is off with `renderExpanded` or `stackOnMobile`."),!P&&y?.length>500&&_(`rows-without-virtual`,`renders more than 500 rows without virtual: add virtual with maxHeight, or page the data.`);let W=P&&z&&!L&&!A&&!C&&y?.length>0,G=(e,t)=>!He||!!He(e,t),Et=E&&y?y.reduce((e,t,n)=>e+ +!!G(t,n),0):0,K=E&&y?y.reduce((e,t,n)=>e+(G(t,n)&&D?.has(b(t,n))?1:0),0):0,Dt=Et>0&&K===Et,Ot=K>0&&!Dt,kt=e=>{e&&(e.indeterminate=Ot)},At=f(null),jt=(e,t)=>{let n=At.current;At.current=e;let r=t&&n!==null?y.findIndex((e,t)=>b(e,t)===n):-1,i=y.findIndex((t,n)=>b(t,n)===e);if(r<0||i<0||r===i){Ue?.(e);return}let a=!D?.has(e),o=Math.min(r,i),s=y.slice(o,Math.max(r,i)+1).map((e,t)=>[e,o+t]).filter(([e,t])=>G(e,t)).map(([e,t])=>b(e,t)).filter(e=>(D?.has(e)||!1)!==a);if(Ge)Ge(s,a);else for(let e of s)Ue?.(e)},Mt=e=>{if(!He){We?.(e);return}(y||[]).forEach((t,n)=>{let r=b(t,n);G(t,n)&&(D?.has(r)||!1)!==e&&Ue?.(r)})},[Nt,Pt]=p(()=>new Set),Ft=e=>Pt(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),q=ne(()=>{let e=(y||[]).map((e,t)=>({row:e,i:t}));return N?me(e,({row:e})=>String(e[N]??``)).flatMap(e=>[{group:e,open:!Nt.has(e.key)},...Nt.has(e.key)?[]:e.items]):e},[y,N,Nt]),J=f(null),It=f(null);u(()=>{let e=J.current;if(!e)return;let t=e=>{let t=e.target.closest?.(`.u-name`);t&&!t.title&&(t.scrollWidth>t.clientWidth||t.scrollHeight>t.clientHeight)&&(t.title=t.textContent.trim())},n=e=>{let t=e.target.closest?.(`tbody > tr[aria-rowindex]`)?.getAttribute(`aria-rowindex`);It.current=t?Number(t)-2:null},r=t=>{e.contains(t.relatedTarget)||(It.current=null)};e.addEventListener(`mouseover`,t),e.addEventListener(`focusin`,t),e.addEventListener(`focusin`,n),e.addEventListener(`focusout`,r);let i=c(e);return()=>{e.removeEventListener(`mouseover`,t),e.removeEventListener(`focusin`,t),e.removeEventListener(`focusin`,n),e.removeEventListener(`focusout`,r),i()}},[B]),u(()=>{if(!k||!J.current)return;let e=s(J.current);return ee(document),e},[k,B]);let Lt=f(!1);u(()=>{!Lt.current&&(Lt.current=!0,K===0)||J.current?.querySelector(`table`)?.dispatchEvent(new CustomEvent(`selectionchange`,{bubbles:!0,detail:{selected:K,total:y?.length??0,keys:y?y.flatMap((e,t)=>{let n=b(e,t);return G(e,t)&&D?.has(n)?[String(n)]:[]}):[]}}))},[E,K]);let[Rt,zt]=p({top:0,height:0}),[Y,Bt]=p(ue[O]??ue.comfortable);u(()=>{let e=J.current;if(!W||!e)return;let t=0,n=()=>{t=0;let n=e.querySelector(`:scope > table > thead`)?.getBoundingClientRect().height||0,r={top:Math.max(0,e.scrollTop-n),height:e.clientHeight};zt(e=>e.top===r.top&&e.height===r.height?e:r)},r=()=>{t||=requestAnimationFrame(n)};e.addEventListener(`scroll`,r,{passive:!0});let i=typeof ResizeObserver<`u`?new ResizeObserver(r):null;return i?.observe(e),n(),()=>{e.removeEventListener(`scroll`,r),i?.disconnect(),t&&cancelAnimationFrame(t)}},[W,B]),d(()=>{if(!W)return;let e=(J.current?.querySelector(`:scope > table > tbody > tr:not(.wui-virtual-spacer, .wui-group-row)`))?.getBoundingClientRect().height;e>0&&Math.abs(e-Y)>.5&&Bt(e)},[O,y?.length,P,W]);let X={start:0,end:q.length,before:0,after:0};if(W){X=Ce({scrollTop:Rt.top,viewport:Rt.height||Number.parseFloat(Qe)||0,rowHeight:Y,count:q.length});let e=It.current;e!==null&&e>=0&&e<q.length&&(e<X.start&&X.start-e<=De&&(X={...X,start:e,before:e*Y}),e>=X.end&&e-X.end<De&&(X={...X,end:e+1,after:(q.length-e-1)*Y}))}let Vt=f(null),Ht=f(null),Ut=f(null),Wt=!P&&!C&&y?.length>0&&y.length<=de;d(()=>{let e=Vt.current;if(!Wt||!e){Ht.current=null,Ut.current=null;return}let t=y.map((e,t)=>b(e,t));be(Ut.current,t)&&ye(e.rows,Ht.current),Ht.current=he(e.rows),Ut.current=t});let Gt=typeof F==`function`||typeof I==`function`,Kt=f(null),qt=f(null);u(()=>{if(!Gt){qt.current=null;return}let e=g[0]?.key,t=new Map;(y||[]).forEach((n,r)=>{let i=e===void 0?void 0:n[e],a=typeof i==`string`||typeof i==`number`?String(i):``;t.set(b(n,r),{...Ae(n,F,I),label:a})});let n=xe(Se(qt.current,t));qt.current=t,n&&Kt.current&&(Kt.current.textContent=n)},[y,F,I,b]);let Z=Ie!==void 0&&(Le===void 0||Le>0)?Ie:Fe,Jt=({group:e,open:t},n)=>{let r=e.items[0].row[N],a=e.items.map(e=>e.row);return m(`tr`,{className:`wui-group-row`,"data-group-key":e.key,"aria-rowindex":W?n+2:void 0,children:m(`th`,{className:`wui-group-cell`,scope:`rowgroup`,colSpan:St,children:h(`button`,{type:`button`,className:`wui-group-toggle`,"aria-expanded":t,onClick:()=>Ft(e.key),children:[m(i,{name:`chevron-down`,size:16}),m(`span`,{className:`wui-group-label`,children:st?st(r,a):Me(r)}),m(`span`,{className:`wui-group-count`,"aria-hidden":`true`,children:pe(e.items.length)}),m(`span`,{className:`visually-hidden wui-group-rows`,children:`, ${se.rows(e.items.length)}`})]})})},`group:${e.key}`)},Yt=({row:e,i:t},n)=>{let r=b(e,t),a=L&&pt.has(r),o=it!=null&&String(it)===String(r),s=at!=null&&String(at)===String(r),c=String(r).replace(/[^a-z0-9]/gi,`_`),ee=H(0,`wui-expand-cell`),l=H(+!!L,`wui-select-cell`),u=Gt?Ae(e,F,I):null,d=G(e,t);return h(te,{children:[h(`tr`,{className:[E&&d&&D?.has(r)?`is-selected`:``,R?`wui-row-link`:``,o?`wui-row-active`:``,s?ie.hover:``].filter(Boolean).join(` `)||void 0,"aria-current":o?`true`:void 0,"aria-rowindex":W?n+2:void 0,"aria-busy":u?.state===`saving`?`true`:void 0,"data-wui-save-state":u?.state||void 0,"data-status":nt?.(e)||void 0,"data-href":j?.(e)||void 0,"data-row-key":k?String(r):void 0,tabIndex:R?0:void 0,onClick:R?t=>vt(e,t):void 0,onAuxClick:R&&j?t=>t.button===1&&vt(e,t):void 0,onKeyDown:R?t=>{t.key===`Enter`&&t.target===t.currentTarget&&vt(e,t)}:void 0,children:[L&&m(`td`,{className:ee.className,style:ee.style,children:m(`button`,{type:`button`,className:`wui-expand-toggle${a?` is-open`:``}`,"aria-expanded":a,"aria-controls":a?`${c}-expanded`:void 0,"aria-label":a?`Collapse row`:`Expand row`,onClick:()=>ht(r),children:m(i,{name:`chevron-down`,size:16})})}),E&&m(`td`,{className:l.className,style:l.style,children:m(`input`,{type:`checkbox`,className:`wui-check`,checked:d&&(D?.has(r)||!1),disabled:!d,onChange:e=>jt(r,e.nativeEvent.shiftKey),onMouseDown:e=>{e.shiftKey&&e.preventDefault()},"aria-label":`Select row`})}),g.map((t,n)=>h(`td`,{className:H(V+n,(n===0?`wui-name-cell `:``)+(t.nowrap?`text-nowrap `:``)+v(t.align)+(t.cellClassName?` ${t.cellClassName}`:``)).className,style:U(V+n,t.cellStyle),"data-label":A&&typeof t.label==`string`?t.label:void 0,children:[t.render?t.render(e):Me(e[t.key]),n===0&&u?.state===`error`&&m(`span`,{className:fe,children:u.message})]},t.key)),w&&m(`td`,{children:m(`div`,{className:`u-row-actions`,children:w(e)})})]}),a&&m(`tr`,{className:`wui-row-expanded`,children:m(`td`,{id:`${c}-expanded`,colSpan:St,children:Ke(e)})})]},r)},Xt=(e,t)=>e.group?Jt(e,t):Yt(e,t),Zt=(e,t)=>W?m(`tr`,{className:`wui-virtual-spacer`,"aria-hidden":`true`,hidden:t===0,children:m(`td`,{colSpan:St,style:{height:t}})},e):null,Q=H(0,`wui-expand-cell`),$=H(+!!L,`wui-select-cell`),Qt=()=>Array.from({length:Pe},(e,t)=>`skeleton-${t}`).map(e=>h(`tr`,{children:[L&&m(`td`,{className:Q.className,style:Q.style}),E&&m(`td`,{className:$.className,style:$.style}),g.map((e,t)=>m(`td`,{className:H(V+t,(t===0?`wui-name-cell `:``)+(e.nowrap?`text-nowrap `:``)+v(e.align)).className,style:U(V+t,void 0),"data-label":A&&typeof e.label==`string`?e.label:void 0,children:m(a,{width:je(e.align),height:12,radius:6})},e.key)),w&&m(`td`,{children:m(`div`,{className:`u-row-actions`,children:m(a,{width:`32px`,height:12,radius:6})})})]},e));return h(re,{children:[h(B?`wui-data-table`:`div`,{ref:J,...B?{class:yt,resizable:M?``:void 0,"view-key":ot||void 0,"data-wui-row-drag":k?``:void 0}:{className:yt,"data-wui-row-drag":k?``:void 0},style:xt,tabIndex:0,...l,...ut,children:[h(`table`,{className:ft,"aria-label":ze,"aria-rowcount":W?q.length+1:void 0,style:qe===`fixed`?{tableLayout:`fixed`}:void 0,children:[m(`thead`,{children:h(`tr`,{"aria-rowindex":W?1:void 0,children:[L&&m(`th`,{className:Q.className,style:Q.style,children:m(`span`,{className:`visually-hidden`,children:`Expand`})}),E&&m(`th`,{className:$.className,style:$.style,children:m(`input`,{ref:kt,type:`checkbox`,className:`wui-check`,checked:Dt,disabled:C,onChange:e=>Mt(e.target.checked),"aria-label":`Select all rows`})}),g.map((e,t)=>{let n=!!(e.sortable&&S),r=x&&x.key===e.key,a=e.align===`num`||e.align===`end`,o=n&&m(`span`,{className:`sort-icon${a?` wui-sort-lead`:``}`,children:m(i,{name:`chevrons-up-down`,size:14})}),s=M&&t!==Tt,c=e.width||e.minWidth?{width:e.width,minWidth:e.minWidth}:void 0;return h(`th`,{className:H(V+t,(n?`sortable `:``)+(t===0?`wui-name-cell `:``)+(e.nowrap?`text-nowrap `:``)+(e.grow?`wui-col-grow `:``)+(s?`wui-col-resizable `:``)+v(e.align)).className,style:U(V+t,c),"data-key":B?e.key:void 0,"aria-label":s&&typeof e.label==`string`?e.label:void 0,"data-pin":e.pin===`start`||e.pin===`end`?e.pin:void 0,tabIndex:n?0:void 0,"aria-sort":r?x.dir===`asc`?`ascending`:`descending`:n?`none`:void 0,onClick:n?()=>{C||S(e.key)}:void 0,onKeyDown:n?t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),C||S(e.key))}:void 0,children:[a&&o,e.label,!a&&o,s&&m(`span`,{className:`wui-col-resize`,role:`separator`,"aria-orientation":`vertical`,"aria-valuemin":oe,"aria-valuemax":ae,tabIndex:0,"aria-label":se.resize(typeof e.label==`string`?e.label:e.key)})]},e.key)}),w&&(Re?m(`th`,{className:`wui-cell-end`,children:Re}):m(`th`,{className:`wui-cell-end`,children:m(`span`,{className:`visually-hidden`,children:`Actions`})}))]})}),m(`tbody`,{ref:Vt,children:C?Qt():y?.length?h(re,{children:[Zt(`before`,X.before),q.slice(X.start,X.end).map((e,t)=>Xt(e,X.start+t)),Zt(`after`,X.after)]}):null}),gt&&!C&&y?.length>0&&m(`tfoot`,{children:h(`tr`,{children:[L&&m(`td`,{className:Q.className,style:Q.style}),E&&m(`td`,{className:$.className,style:$.style}),g.map((e,t)=>m(`td`,{className:H(V+t,(t===0?`wui-name-cell `:``)+(e.nowrap?`text-nowrap `:``)+v(e.align)).className,style:U(V+t,void 0),children:e.footer?e.footer(y):null},e.key)),w&&m(`td`,{})]})})]}),!C&&!y?.length&&m(`div`,{className:`tbl-empty-block`,children:typeof Z==`string`?m(`div`,{className:`tbl-empty-plain`,children:Z}):Z})]}),Ne(T)&&m(o,{page:T.page,totalPages:T.totalPages,pageSize:T.pageSize,onPageChange:C?ke:T.setPage,onPageSizeChange:C?ke:T.setPageSize,pageSizes:T.pageSizes,mode:T.mode}),Gt&&m(`div`,{ref:Kt,className:`visually-hidden`,role:`status`,"aria-live":`polite`,"data-wui-table-status":``})]})}export{y as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{splitMarkerProps as e}from"../lib/wuiMarker.js";import{devWarn as t}from"../lib/devWarn.js";import n from"./warnInvalidValue.js";import r from"./warnUnknownProps.js";import i from"../lib/FieldMessage.js";import a from"./AppRequiredMark.js";import o from"./useWuiControl.js";import{cloneElement as s,forwardRef as c,useId as l}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";import"@webority/ui-elements/elements/datepicker";var f=[`sm`,`md`,`lg`],p=c(function(c,p){let{marker:m,props:h}=e(`AppDatePicker`,c),{value:g,onChange:_,label:v,required:y=!1,
|
|
1
|
+
import{splitMarkerProps as e}from"../lib/wuiMarker.js";import{devWarn as t}from"../lib/devWarn.js";import n from"./warnInvalidValue.js";import r from"./warnUnknownProps.js";import i from"../lib/FieldMessage.js";import a from"./AppRequiredMark.js";import o from"./useWuiControl.js";import{cloneElement as s,forwardRef as c,useId as l}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";import"@webority/ui-elements/elements/datepicker";var f=[`sm`,`md`,`lg`],p=c(function(c,p){let{marker:m,props:h}=e(`AppDatePicker`,c),{value:g,onChange:_,label:v,required:y=!1,optional:b=!1,hint:x,error:S,name:C,min:w,max:T,placeholder:E=`Choose a date`,disabled:D,size:O,firstDay:k,displayFormat:A,id:j,ariaLabel:M,className:N=``,fieldClassName:P=``,...F}=h;r(`AppDatePicker`,F),n(`AppDatePicker`,`size`,O,f),typeof A==`string`&&A!==``&&/DD|YYYY|YY/.test(A)&&t(`[@webority/ui-react] <AppDatePicker> displayFormat "${A}" uses uppercase day or year tokens, which print as written; the tokens are yyyy, MMMM, MMM, MM, dd and d.`);let I=l(),L=j||I,{setRef:R}=o({ref:p,value:g??``,onChange:_}),z=!v&&!S&&!x,B=S?`${L}-error`:void 0,V=x?`${L}-hint`:void 0,H=u(`wui-datepicker`,{ref:R,value:g||void 0,id:L,name:C,min:w,max:T,placeholder:E,size:O||void 0,"first-day":k==null?void 0:String(k),"display-format":A||void 0,"aria-label":M||(typeof v==`string`?v:void 0),"aria-describedby":B||V,"aria-invalid":S?`true`:void 0,disabled:D?``:void 0,required:y?``:void 0,className:N||void 0,...F});return z?s(H,m):d(`div`,{...m,className:`field${P?` ${P}`:``}`,children:[v&&d(`label`,{className:`label`,htmlFor:L,children:[v,b&&!y&&u(`span`,{className:`label-optional`,children:` (optional)`}),y&&u(a,{})]}),H,u(i,{error:S,hint:x,errorId:B,hintId:V})]})});export{p as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import r from"../lib/FieldMessage.js";import i from"./AppRequiredMark.js";import a from"./useWuiControl.js";import{cloneElement as o,forwardRef as s,useEffect as c,useId as l}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";import"@webority/ui-elements/elements/date-range";var f=[`sm`,`md`,`lg`],p=e=>{if(e?.length)return e.every(e=>typeof e==`string`)?e.join(`,`):JSON.stringify(e)},m=s(function(s,m){let{marker:h,props:g}=e(`AppDateRangePicker`,s),{start:_,end:v,onChange:y,label:b,required:x=!1,
|
|
1
|
+
import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import r from"../lib/FieldMessage.js";import i from"./AppRequiredMark.js";import a from"./useWuiControl.js";import{cloneElement as o,forwardRef as s,useEffect as c,useId as l}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";import"@webority/ui-elements/elements/date-range";var f=[`sm`,`md`,`lg`],p=e=>{if(e?.length)return e.every(e=>typeof e==`string`)?e.join(`,`):JSON.stringify(e)},m=s(function(s,m){let{marker:h,props:g}=e(`AppDateRangePicker`,s),{start:_,end:v,onChange:y,label:b,required:x=!1,optional:S=!1,hint:C,error:w,startName:T,endName:E,min:D,max:O,placeholder:k=`Start to End`,disabled:A,size:j,firstDay:M,presets:N,id:P,ariaLabel:F,className:I=``,fieldClassName:L=``,...R}=g;n(`AppDateRangePicker`,R),t(`AppDateRangePicker`,`size`,j,f);let z=l(),B=P||z,{setRef:V,innerRef:H}=a({ref:m,onChange:y});c(()=>{let e=H.current;if(!e)return;let t=_===void 0?e.value.start:_,n=v===void 0?e.value.end:v;(e.value.start!==t||e.value.end!==n)&&(e.value={start:t,end:n})},[_,v,H]);let U=!b&&!w&&!C,W=w?`${B}-error`:void 0,G=C?`${B}-hint`:void 0,K=W||G,q=u(`wui-date-range`,{ref:V,id:B,"start-name":T,"end-name":E,min:D,max:O,placeholder:k,size:j||void 0,"first-day":M==null?void 0:String(M),presets:p(N),"aria-label":F||(typeof b==`string`?b:void 0),"aria-describedby":K,"aria-invalid":w?`true`:void 0,disabled:A?``:void 0,required:x?``:void 0,className:I||void 0,...R});return U?o(q,h):d(`div`,{...h,className:`field${L?` ${L}`:``}`,children:[b&&d(`label`,{className:`label`,htmlFor:B,children:[b,S&&!x&&u(`span`,{className:`label-optional`,children:` (optional)`}),x&&u(i,{})]}),q,u(r,{error:w,hint:C,errorId:W,hintId:G})]})});export{m as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import r from"./AppIcon.js";import i from"../lib/DiscardPrompt.js";import{useEffect as
|
|
1
|
+
import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import r from"./AppIcon.js";import i from"../lib/DiscardPrompt.js";import{lockPageScroll as a}from"../lib/pageScrollLock.js";import{useEffect as o,useRef as s,useState as c}from"react";import{jsx as l,jsxs as u}from"react/jsx-runtime";import"@webority/ui-elements/elements/drawer";var d=[`end`,`start`],f=[`sm`,`md`,`lg`,`xl`],p=[50,90],m=e=>Array.isArray(e)&&e.length>0&&e.every(e=>Number.isFinite(e)&&e>=10&&e<=100);function h(h){let{marker:g,props:_}=e(`AppDrawer`,h),{open:v=!1,onClose:y,title:b,titleIcon:x,header:S,subtitle:C,ariaLabel:w,side:T=`end`,size:E=`md`,width:D,maxWidth:O,snapPoints:k=p,defaultSnap:A=0,sheet:j=!0,onSnapChange:M,onOpened:N,onClosed:P,dismissible:F=!0,closeLabel:I=`Close`,staticBackdrop:L=!1,confirmDiscard:R,dirty:z=!1,headerClassName:B=``,bodyClassName:V=``,footer:H,className:U=``,style:W,children:G,...K}=_;n(`AppDrawer`,K),t(`AppDrawer`,`side`,T,d),t(`AppDrawer`,`size`,E,f),t(`AppDrawer`,`snapPoints`,m(k)?void 0:JSON.stringify(k),[`an array of numbers from 10 to 100`]);let q=s(null),J=s(null),Y=s(null),[X,Z]=c(!1);J.current={onClose:y,onSnapChange:M,onOpened:N,onClosed:P,confirmDiscard:R,dirty:z},o(()=>{v||Z(!1)},[v]),o(()=>{X&&Y.current?.focus()},[X]),o(()=>{if(v)return a()},[v]),o(()=>{let e=q.current;if(!e)return;let t=t=>{if(t.target===e){if(t.preventDefault(),J.current.confirmDiscard&&J.current.dirty){Z(!0);return}J.current.onClose?.()}},n=t=>{t.target===e&&J.current.onSnapChange?.(t.detail.index,t.detail.percent)},r=t=>{t.target===e&&J.current.onOpened?.()},i=t=>{t.target===e&&J.current.onClosed?.()},a=n=>{n.target.closest?.(`[data-wui-dismiss]`)&&t({target:e,preventDefault(){}})};return e.addEventListener(`wui-drawer-close`,t),e.addEventListener(`wui-drawer-snap`,n),e.addEventListener(`wui-drawer-opened`,r),e.addEventListener(`wui-drawer-closed`,i),e.addEventListener(`click`,a),()=>{e.removeEventListener(`wui-drawer-close`,t),e.removeEventListener(`wui-drawer-snap`,n),e.removeEventListener(`wui-drawer-opened`,r),e.removeEventListener(`wui-drawer-closed`,i),e.removeEventListener(`click`,a)}},[]);let Q=()=>{Z(!1),q.current?.dispatchEvent(new CustomEvent(`wui:drawer:discard`,{bubbles:!0})),J.current.onClose?.()},$=m(k)?k:p,ee={...D&&{"--wui-drawer-width":D},...O&&{"--wui-drawer-max-width":O},...W};return u(`wui-drawer`,{ref:q,...g,...K,class:[`wui-drawer`,U].filter(Boolean).join(` `),side:T,size:E,"snap-points":$.join(`,`),"default-snap":String(A),static:L?``:void 0,"no-sheet":j?void 0:``,"confirm-discard":R||void 0,open:v?``:void 0,style:ee,children:[l(`div`,{className:`wui-drawer-backdrop`,"data-wui-drawer-backdrop":``,"aria-hidden":`true`}),u(`div`,{className:`wui-drawer-panel`,role:`dialog`,"aria-modal":`true`,"aria-label":w||b||void 0,tabIndex:-1,children:[j&&l(`div`,{className:`wui-drawer-grip`,"data-wui-drawer-grip":``,children:l(`div`,{className:`wui-drawer-handle`,role:`slider`,tabIndex:0,"aria-orientation":`vertical`,"aria-label":`Sheet height`})}),S===void 0?u(`div`,{className:[`wui-drawer-header`,B].filter(Boolean).join(` `),"data-wui-drawer-grip":j?``:void 0,children:[u(`div`,{className:`wui-drawer-headtext`,children:[b&&u(`div`,{className:`wui-drawer-title`,children:[x&&l(`span`,{className:`wui-drawer-title-ic`,children:l(r,{name:x,size:18})}),b]}),C&&l(`div`,{className:`wui-drawer-subtitle`,children:C})]}),F&&l(`button`,{type:`button`,className:`wui-drawer-close`,"data-wui-drawer-close":``,"aria-label":I,children:l(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:l(`path`,{d:`M18 6 6 18M6 6l12 12`})})})]}):S,l(`div`,{className:[`wui-drawer-body`,V].filter(Boolean).join(` `),children:G}),(H||X)&&u(`div`,{className:X?`wui-drawer-footer wui-drawer-discarding`:`wui-drawer-footer`,children:[X&&l(i,{text:R,confirmRef:Y,onDiscard:Q,onKeep:()=>Z(!1)}),H]})]})]})}export{h as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{splitMarkerProps as e}from"../lib/wuiMarker.js";import{devWarn as t}from"../lib/devWarn.js";import n from"./warnInvalidValue.js";import r from"./warnUnknownProps.js";import i from"./withTooltip.js";import a from"./AppIcon.js";import
|
|
1
|
+
import{splitMarkerProps as e}from"../lib/wuiMarker.js";import{devWarn as t}from"../lib/devWarn.js";import n from"./warnInvalidValue.js";import r from"./warnUnknownProps.js";import i from"./withTooltip.js";import a from"./AppIcon.js";import o from"../lib/FieldMessage.js";import ee from"./AppRequiredMark.js";import te from"./AppSpinner.js";import ne from"../lib/useFileDrop.js";import{keyOf as s}from"../lib/fileItem.js";import re from"../lib/FileItemRow.js";import{DEFAULT_MAX_SIZE_MB as ie,acceptDroppedFiles as ae,acceptLabel as c,isImageFile as l,isImageOnlyAccept as oe,isPdfFile as se}from"@webority/ui-elements/helpers";import{useEffect as u,useId as ce,useRef as le,useState as d}from"react";import{jsx as f,jsxs as p}from"react/jsx-runtime";var m=[`dropzone`,`button`];function h(h){let{marker:ue,props:de}=e(`AppFilePicker`,h),{label:g,value:_,name:fe,id:pe,onPick:v,multiple:y=!1,variant:b=`dropzone`,buttonLabel:me=`Add file`,maxFiles:x,accept:S=`.jpg,.jpeg,.png`,maxSizeMb:C=ie,required:w,optional:T=!1,error:he,hint:E,loading:D=!1,className:O=``,fieldClassName:k=``,style:A,...j}=de;r(`AppFilePicker`,j),n(`AppFilePicker`,`variant`,b,m);let[ge,M]=d(null),[_e,N]=d(null),[P,F]=d(``),I=le(null),ve=ce(),L=pe||ve;u(()=>{if(!y&&_ instanceof File&&l(_)){let e=URL.createObjectURL(_);return M(e),()=>URL.revokeObjectURL(e)}M(null)},[_,y]);let R=!y&&_&&!l(_)&&se(_)?_ instanceof File?_:_.url:null;u(()=>{if(!R){N(null);return}let e=!0,n=null;return import(`@webority/ui-elements/file-viewer`).then(e=>e.renderPdfFirstPage(typeof R==`string`?{url:R}:R)).then(t=>{e&&(n=URL.createObjectURL(t),N(n))}).catch(e=>t(`[AppFilePicker] the PDF preview failed:`,e?.message)),()=>{e=!1,N(null),n&&URL.revokeObjectURL(n)}},[R]);let z=y?Array.isArray(_)?_:_?[_]:[]:[],B=he||P,V=B?`${L}-error`:void 0,H=E&&!B?`${L}-hint`:void 0,ye=V||H,U=oe(S),be=b===`button`,W=!y&&!!_,G=W&&(_ instanceof File?l(_):U||l(_)),xe=_?.name,K=G?_?.url||ge:_e,q=G?`image`:`file`,Se=g?`Change ${g}`:`Change ${q}`,J=g?`Remove ${g}`:`Remove ${q}`,Ce=g?`${g} preview`:`Selected ${q} preview`,Y={accept:S,maxSizeMb:C,multiple:y},X=e=>{if(F(``),!y){v(e[0]);return}let t=Array.isArray(_)?_:_?[_]:[],n=new Set(t.map(s)),r=[];for(let t of e)n.has(s(t))||(n.add(s(t)),r.push(t));let i=t.concat(r);x&&i.length>x&&(i=i.slice(0,x),F(`Up to ${x} files.`)),v(i)},Z=e=>F(e.message),{dragOver:we,dropProps:Te}=ne({...Y,disabled:D,onFiles:X,onReject:Z}),Ee=e=>{let{files:t,rejections:n}=ae(e,Y);t.length&&X(t),n.length&&Z(n[0])},De=e=>Ee(e.target.files),Oe=e=>{F(``),v(z.filter((t,n)=>n!==e))},ke=()=>I.current?.click(),Q=D?f(`span`,{className:`wui-file-busy`,children:f(te,{size:`sm`})}):null,$=f(`input`,{id:L,name:fe,ref:I,type:`file`,"aria-describedby":ye,accept:S,multiple:y||void 0,disabled:D||void 0,className:`visually-hidden`,onClick:e=>{e.currentTarget.value=``},onChange:De,...j});return p(`div`,{...ue,className:`field${k?` ${k}`:``}`,children:[p(`label`,{className:`label`,htmlFor:L,children:[g,T&&!w&&f(`span`,{className:`label-optional`,children:` (optional)`}),w&&f(ee,{})]}),be?p(`div`,{className:`file-input wui-file-input-button-field${B?` error`:``}${O?` ${O}`:``}`,style:A,"aria-busy":D||void 0,children:[p(`label`,{htmlFor:L,className:`btn btn-outline-primary btn-sm`,children:[f(a,{name:`paperclip`,size:16}),me]}),$,Q]}):W?p(`div`,{className:`file-preview${B?` error`:``}${O?` ${O}`:``}`,style:A,"aria-busy":D||void 0,children:[p(`button`,{type:`button`,className:`file-preview-open`,"aria-label":Se,onClick:ke,disabled:D,children:[K?f(`img`,{src:K,alt:Ce,className:`file-preview-img`}):p(`span`,{className:`file-preview-file`,children:[f(a,{name:`file-text`,size:28}),f(`span`,{className:`file-preview-file-name`,children:xe})]}),f(`span`,{className:`file-preview-overlay`,children:p(`span`,{className:`file-preview-cta`,children:[f(a,{name:G?`image`:`file-text`,size:16}),` `,G?`Change image`:`Change file`]})})]}),i(f(`button`,{type:`button`,className:`file-preview-remove`,"aria-label":J,onClick:()=>v(null),disabled:D,children:f(a,{name:`x`,size:16})}),J),$,Q]}):p(`div`,{className:`file-input file-input-tall${we?` dragging`:``}${B?` error`:``}${y&&z.length>0?` has-files`:``}${O?` ${O}`:``}`,style:A,"aria-busy":D||void 0,...Te,children:[p(`label`,{htmlFor:L,className:`file-input-zone-label`,children:[f(`span`,{className:`file-input-icon`,children:f(a,{name:`upload`,size:24})}),p(`span`,{className:`file-input-title`,children:[f(`span`,{className:`browse`,children:`Click to upload`}),` or drag & drop`]}),f(`span`,{className:`file-input-text`,children:C>0?`${c(S)}, up to ${C} MB`:c(S)})]}),$,Q,y&&z.length>0&&f(`div`,{className:`attach-list`,children:z.map((e,t)=>f(re,{item:e,isImage:e instanceof File?l(e):U||l(e),noun:`file`,onRemove:()=>Oe(t)},s(e)))})]}),f(o,{error:B,hint:E,errorId:V,hintId:H})]})}export{h as default};
|