@orangesix/react 1.1.0 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/api/index.cjs.js +1 -1
  2. package/api/index.cjs.js.map +1 -1
  3. package/api/index.d.ts +100 -3
  4. package/api/index.esm.js +1 -1
  5. package/api/index.esm.js.map +1 -1
  6. package/autocomplete/index.cjs.js.map +1 -1
  7. package/autocomplete/index.d.ts +17 -1
  8. package/autocomplete/index.esm.js.map +1 -1
  9. package/editor/index.cjs.js +1 -1
  10. package/editor/index.cjs.js.map +1 -1
  11. package/editor/index.d.ts +17 -1
  12. package/editor/index.esm.js +1 -1
  13. package/editor/index.esm.js.map +1 -1
  14. package/input/index.cjs.js +2 -0
  15. package/input/index.cjs.js.map +1 -0
  16. package/input/index.d.ts +210 -0
  17. package/input/index.esm.js +2 -0
  18. package/input/index.esm.js.map +1 -0
  19. package/input/package.json +5 -0
  20. package/inputfilter/index.cjs.js.map +1 -1
  21. package/inputfilter/index.d.ts +17 -1
  22. package/inputfilter/index.esm.js.map +1 -1
  23. package/loading/_loading.scss +10 -0
  24. package/loading/index.cjs.js +2 -0
  25. package/loading/index.cjs.js.map +1 -0
  26. package/loading/index.d.ts +172 -0
  27. package/loading/index.esm.js +2 -0
  28. package/loading/index.esm.js.map +1 -0
  29. package/loading/package.json +5 -0
  30. package/modal/index.cjs.js +2 -0
  31. package/modal/index.cjs.js.map +1 -0
  32. package/modal/index.d.ts +68 -0
  33. package/modal/index.esm.js +2 -0
  34. package/modal/index.esm.js.map +1 -0
  35. package/modal/package.json +5 -0
  36. package/package.json +24 -13
  37. package/picklist/index.cjs.js +2 -0
  38. package/picklist/index.cjs.js.map +1 -0
  39. package/picklist/index.d.ts +73 -0
  40. package/picklist/index.esm.js +2 -0
  41. package/picklist/index.esm.js.map +1 -0
  42. package/picklist/package.json +5 -0
  43. package/radio/index.cjs.js +2 -0
  44. package/radio/index.cjs.js.map +1 -0
  45. package/radio/index.d.ts +188 -0
  46. package/radio/index.esm.js +2 -0
  47. package/radio/index.esm.js.map +1 -0
  48. package/radio/package.json +5 -0
  49. package/select/index.cjs.js +2 -0
  50. package/select/index.cjs.js.map +1 -0
  51. package/select/index.d.ts +195 -0
  52. package/select/index.esm.js +2 -0
  53. package/select/index.esm.js.map +1 -0
  54. package/select/package.json +5 -0
  55. package/style/scss/_variables.scss +4 -0
  56. package/style/scss/bootstrap.scss +1 -0
  57. package/style/scss/components/button/_button.scss +494 -494
  58. package/style/scss/components/data/_datatable.scss +1 -0
  59. package/style/scss/components/data/_picklist.scss +61 -61
  60. package/style/scss/components/input/_iconfield.scss +5 -4
  61. package/style/scss/components/input/_inputswitch.scss +80 -70
  62. package/style/scss/core/_mixins.scss +195 -195
  63. package/style/scss/core/_reset.scss +75 -74
  64. package/switch/index.cjs.js +2 -0
  65. package/switch/index.cjs.js.map +1 -0
  66. package/switch/index.d.ts +169 -0
  67. package/switch/index.esm.js +2 -0
  68. package/switch/index.esm.js.map +1 -0
  69. package/switch/package.json +5 -0
  70. package/table/index.cjs.js +1 -1
  71. package/table/index.cjs.js.map +1 -1
  72. package/table/index.d.ts +14 -1
  73. package/table/index.esm.js +1 -1
  74. package/table/index.esm.js.map +1 -1
  75. package/tabview/index.d.ts +17 -1
  76. package/textarea/index.cjs.js +2 -0
  77. package/textarea/index.cjs.js.map +1 -0
  78. package/textarea/index.d.ts +165 -0
  79. package/textarea/index.esm.js +2 -0
  80. package/textarea/index.esm.js.map +1 -0
  81. package/textarea/package.json +5 -0
@@ -1,243 +1,243 @@
1
1
  @mixin icon-override($icon) {
2
- &:before {
3
- content: $icon;
4
- }
2
+ &:before {
3
+ content: $icon;
4
+ }
5
5
  }
6
6
 
7
7
  @mixin focused() {
8
- outline: $focusOutline;
9
- outline-offset: $focusOutlineOffset;
10
- box-shadow: $focusShadow;
8
+ outline: $focusOutline;
9
+ outline-offset: $focusOutlineOffset;
10
+ box-shadow: $focusShadow;
11
11
  }
12
12
 
13
13
  @mixin focused-inset() {
14
- outline: $focusOutline;
15
- outline-offset: $focusOutlineOffset;
16
- box-shadow: inset $focusShadow;
14
+ outline: $focusOutline;
15
+ outline-offset: $focusOutlineOffset;
16
+ box-shadow: inset $focusShadow;
17
17
  }
18
18
 
19
19
  @mixin focused-input() {
20
- @include focused();
21
- border-color: $inputFocusBorderColor;
20
+ @include focused();
21
+ border-color: $inputFocusBorderColor;
22
22
  }
23
23
 
24
24
  @mixin focused-listitem() {
25
- outline: $focusOutline;
26
- outline-offset: $focusOutlineOffset;
27
- box-shadow: $inputListItemFocusShadow;
25
+ outline: $focusOutline;
26
+ outline-offset: $focusOutlineOffset;
27
+ box-shadow: $inputListItemFocusShadow;
28
28
  }
29
29
 
30
30
  @mixin invalid-input() {
31
- border-color: $inputErrorBorderColor;
31
+ border-color: $inputErrorBorderColor;
32
32
  }
33
33
 
34
34
  @mixin menuitem-link {
35
- > .p-menuitem-content {
36
- color: $menuitemTextColor;
37
- transition: $listItemTransition;
38
- border-radius: $menuitemBorderRadius;
39
-
40
- .p-menuitem-link {
41
- color: $menuitemTextColor;
42
- padding: $menuitemPadding;
43
- user-select: none;
44
-
45
- .p-menuitem-text {
46
- color: $menuitemTextColor;
47
- }
48
-
49
- .p-menuitem-icon {
50
- color: $menuitemIconColor;
51
- margin-right: $inlineSpacing;
52
- }
53
-
54
- .p-submenu-icon {
55
- color: $menuitemIconColor;
56
- }
57
- }
58
- }
59
-
60
- &.p-highlight {
61
- > .p-menuitem-content {
62
- color: $menuitemTextActiveColor;
63
- background: $menuitemActiveBg;
64
-
65
- .p-menuitem-link {
66
- .p-menuitem-text {
67
- color: $menuitemTextActiveColor;
68
- }
69
-
70
- .p-menuitem-icon,
71
- .p-submenu-icon {
72
- color: $menuitemIconActiveColor;
73
- }
74
- }
75
- }
76
-
77
- &.p-focus {
78
- > .p-menuitem-content {
79
- background: $menuitemActiveFocusBg;
80
- }
81
- }
82
- }
83
-
84
- &:not(.p-highlight):not(.p-disabled) {
85
- &.p-focus {
86
- > .p-menuitem-content {
87
- color: $menuitemTextFocusColor;
88
- background: $menuitemFocusBg;
89
-
90
- .p-menuitem-link {
91
- .p-menuitem-text {
92
- color: $menuitemTextFocusColor;
93
- }
94
-
95
- .p-menuitem-icon,
96
- .p-submenu-icon {
97
- color: $menuitemIconFocusColor;
98
- }
99
- }
100
- }
101
- }
102
-
103
- > .p-menuitem-content {
104
- &:hover {
105
- color: $menuitemTextHoverColor;
106
- background: $menuitemHoverBg;
107
-
108
- .p-menuitem-link {
109
- .p-menuitem-text {
110
- color: $menuitemTextHoverColor;
111
- }
112
-
113
- .p-menuitem-icon,
114
- .p-submenu-icon {
115
- color: $menuitemIconHoverColor;
116
- }
117
- }
118
- }
119
- }
120
- }
35
+ > .p-menuitem-content {
36
+ color: $menuitemTextColor;
37
+ transition: $listItemTransition;
38
+ border-radius: $menuitemBorderRadius;
39
+
40
+ .p-menuitem-link {
41
+ color: $menuitemTextColor;
42
+ padding: $menuitemPadding;
43
+ user-select: none;
44
+
45
+ .p-menuitem-text {
46
+ color: $menuitemTextColor;
47
+ }
48
+
49
+ .p-menuitem-icon {
50
+ color: $menuitemIconColor;
51
+ margin-right: $inlineSpacing;
52
+ }
53
+
54
+ .p-submenu-icon {
55
+ color: $menuitemIconColor;
56
+ }
57
+ }
58
+ }
59
+
60
+ &.p-highlight {
61
+ > .p-menuitem-content {
62
+ color: $menuitemTextActiveColor;
63
+ background: $menuitemActiveBg;
64
+
65
+ .p-menuitem-link {
66
+ .p-menuitem-text {
67
+ color: $menuitemTextActiveColor;
68
+ }
69
+
70
+ .p-menuitem-icon,
71
+ .p-submenu-icon {
72
+ color: $menuitemIconActiveColor;
73
+ }
74
+ }
75
+ }
76
+
77
+ &.p-focus {
78
+ > .p-menuitem-content {
79
+ background: $menuitemActiveFocusBg;
80
+ }
81
+ }
82
+ }
83
+
84
+ &:not(.p-highlight):not(.p-disabled) {
85
+ &.p-focus {
86
+ > .p-menuitem-content {
87
+ color: $menuitemTextFocusColor;
88
+ background: $menuitemFocusBg;
89
+
90
+ .p-menuitem-link {
91
+ .p-menuitem-text {
92
+ color: $menuitemTextFocusColor;
93
+ }
94
+
95
+ .p-menuitem-icon,
96
+ .p-submenu-icon {
97
+ color: $menuitemIconFocusColor;
98
+ }
99
+ }
100
+ }
101
+ }
102
+
103
+ > .p-menuitem-content {
104
+ &:hover {
105
+ color: $menuitemTextHoverColor;
106
+ background: $menuitemHoverBg;
107
+
108
+ .p-menuitem-link {
109
+ .p-menuitem-text {
110
+ color: $menuitemTextHoverColor;
111
+ }
112
+
113
+ .p-menuitem-icon,
114
+ .p-submenu-icon {
115
+ color: $menuitemIconHoverColor;
116
+ }
117
+ }
118
+ }
119
+ }
120
+ }
121
121
  }
122
122
 
123
123
  @mixin horizontal-rootmenuitem-link {
124
- > .p-menuitem-content {
125
- color: $horizontalMenuRootMenuitemTextColor;
126
- transition: $listItemTransition;
127
- border-radius: $horizontalMenuRootMenuitemBorderRadius;
128
-
129
- .p-menuitem-link {
130
- padding: $horizontalMenuRootMenuitemPadding;
131
- user-select: none;
132
-
133
- .p-menuitem-text {
134
- color: $horizontalMenuRootMenuitemTextColor;
135
- }
136
-
137
- .p-menuitem-icon {
138
- color: $horizontalMenuRootMenuitemIconColor;
139
- margin-right: $inlineSpacing;
140
- }
141
-
142
- .p-submenu-icon {
143
- color: $horizontalMenuRootMenuitemIconColor;
144
- margin-left: $inlineSpacing;
145
- }
146
- }
147
- }
148
-
149
- &:not(.p-highlight):not(.p-disabled) {
150
- > .p-menuitem-content {
151
- &:hover {
152
- color: $horizontalMenuRootMenuitemTextHoverColor;
153
- background: $horizontalMenuRootMenuitemHoverBg;
154
-
155
- .p-menuitem-link {
156
- .p-menuitem-text {
157
- color: $horizontalMenuRootMenuitemTextHoverColor;
158
- }
159
-
160
- .p-menuitem-icon,
161
- .p-submenu-icon {
162
- color: $horizontalMenuRootMenuitemIconHoverColor;
163
- }
164
- }
165
- }
166
- }
167
- }
124
+ > .p-menuitem-content {
125
+ color: $horizontalMenuRootMenuitemTextColor;
126
+ transition: $listItemTransition;
127
+ border-radius: $horizontalMenuRootMenuitemBorderRadius;
128
+
129
+ .p-menuitem-link {
130
+ padding: $horizontalMenuRootMenuitemPadding;
131
+ user-select: none;
132
+
133
+ .p-menuitem-text {
134
+ color: $horizontalMenuRootMenuitemTextColor;
135
+ }
136
+
137
+ .p-menuitem-icon {
138
+ color: $horizontalMenuRootMenuitemIconColor;
139
+ margin-right: $inlineSpacing;
140
+ }
141
+
142
+ .p-submenu-icon {
143
+ color: $horizontalMenuRootMenuitemIconColor;
144
+ margin-left: $inlineSpacing;
145
+ }
146
+ }
147
+ }
148
+
149
+ &:not(.p-highlight):not(.p-disabled) {
150
+ > .p-menuitem-content {
151
+ &:hover {
152
+ color: $horizontalMenuRootMenuitemTextHoverColor;
153
+ background: $horizontalMenuRootMenuitemHoverBg;
154
+
155
+ .p-menuitem-link {
156
+ .p-menuitem-text {
157
+ color: $horizontalMenuRootMenuitemTextHoverColor;
158
+ }
159
+
160
+ .p-menuitem-icon,
161
+ .p-submenu-icon {
162
+ color: $horizontalMenuRootMenuitemIconHoverColor;
163
+ }
164
+ }
165
+ }
166
+ }
167
+ }
168
168
  }
169
169
 
170
170
  @mixin placeholder {
171
- ::-webkit-input-placeholder {
172
- @content;
173
- }
174
- :-moz-placeholder {
175
- @content;
176
- }
177
- ::-moz-placeholder {
178
- @content;
179
- }
180
- :-ms-input-placeholder {
181
- @content;
182
- }
171
+ ::-webkit-input-placeholder {
172
+ @content;
173
+ }
174
+ :-moz-placeholder {
175
+ @content;
176
+ }
177
+ ::-moz-placeholder {
178
+ @content;
179
+ }
180
+ :-ms-input-placeholder {
181
+ @content;
182
+ }
183
183
  }
184
184
 
185
185
  @mixin scaledPadding($val, $scale) {
186
- padding: nth($val, 1) * $scale nth($val, 2) * $scale;
186
+ padding: nth($val, 1) * $scale nth($val, 2) * $scale;
187
187
  }
188
188
 
189
189
  @mixin scaledFontSize($val, $scale) {
190
- font-size: $val * $scale;
190
+ font-size: #{$val * $scale} !important;
191
191
  }
192
192
 
193
193
  @mixin nested-submenu-indents($val, $index, $length) {
194
- ul {
195
- li {
196
- a {
197
- padding-left: $val * ($index + 1);
198
- }
194
+ ul {
195
+ li {
196
+ a {
197
+ padding-left: $val * ($index + 1);
198
+ }
199
199
 
200
- @if $index < $length {
201
- @include nested-submenu-indents($val, $index + 2, $length);
202
- }
203
- }
204
- }
200
+ @if $index < $length {
201
+ @include nested-submenu-indents($val, $index + 2, $length);
202
+ }
203
+ }
204
+ }
205
205
  }
206
206
 
207
207
  @mixin action-icon($enabled: true) {
208
- width: $actionIconWidth;
209
- height: $actionIconHeight;
210
- color: $actionIconColor;
211
- border: $actionIconBorder;
212
- background: $actionIconBg;
213
- border-radius: $actionIconBorderRadius;
214
- transition: $actionIconTransition;
215
-
216
- @if $enabled {
217
- &:enabled:hover {
218
- @include action-icon-hover();
219
- }
220
- } @else {
221
- &:hover {
222
- @include action-icon-hover();
223
- }
224
- }
225
-
226
- &:focus-visible {
227
- @include focused();
228
- }
208
+ width: $actionIconWidth;
209
+ height: $actionIconHeight;
210
+ color: $actionIconColor;
211
+ border: $actionIconBorder;
212
+ background: $actionIconBg;
213
+ border-radius: $actionIconBorderRadius;
214
+ transition: $actionIconTransition;
215
+
216
+ @if $enabled {
217
+ &:enabled:hover {
218
+ @include action-icon-hover();
219
+ }
220
+ } @else {
221
+ &:hover {
222
+ @include action-icon-hover();
223
+ }
224
+ }
225
+
226
+ &:focus-visible {
227
+ @include focused();
228
+ }
229
229
  }
230
230
 
231
231
  @mixin action-icon-hover() {
232
- color: $actionIconHoverColor;
233
- border-color: $actionIconHoverBorderColor;
234
- background: $actionIconHoverBg;
232
+ color: $actionIconHoverColor;
233
+ border-color: $actionIconHoverBorderColor;
234
+ background: $actionIconHoverBg;
235
235
  }
236
236
 
237
237
  @function tint($color, $percentage) {
238
- @return mix(#fff, $color, $percentage);
238
+ @return mix(#fff, $color, $percentage);
239
239
  }
240
240
 
241
241
  @function shade($color, $percentage) {
242
- @return mix(#000, $color, $percentage);
242
+ @return mix(#000, $color, $percentage);
243
243
  }
@@ -1,75 +1,76 @@
1
- * {
2
- box-sizing: border-box;
3
- }
4
-
5
- .p-component {
6
- font-family: var(--font-family);
7
- font-feature-settings: var(--font-feature-settings, normal);
8
- font-size: $fontSize;
9
- font-weight: $fontWeight;
10
- }
11
-
12
- .p-component-overlay {
13
- background-color: $maskBg;
14
- transition-duration: $transitionDuration;
15
- }
16
-
17
- .p-disabled, .p-component:disabled {
18
- opacity: $disabledOpacity;
19
- }
20
-
21
- .p-error {
22
- color: $errorColor;
23
- }
24
-
25
- .p-text-secondary {
26
- color: $textSecondaryColor;
27
- }
28
-
29
- .pi {
30
- font-size: $primeIconFontSize;
31
- }
32
-
33
- .p-icon {
34
- width: $primeIconFontSize;
35
- height: $primeIconFontSize;
36
- }
37
-
38
- .p-link {
39
- font-family: var(--font-family);
40
- font-feature-settings: var(--font-feature-settings, normal);
41
- font-size: $fontSize;
42
- border-radius: $borderRadius;
43
-
44
- &:focus-visible {
45
- @include focused();
46
- }
47
- }
48
-
49
- .p-component-overlay-enter {
50
- animation: p-component-overlay-enter-animation 150ms forwards;
51
- }
52
-
53
- .p-component-overlay-leave {
54
- animation: p-component-overlay-leave-animation 150ms forwards;
55
- }
56
-
57
- .p-component-overlay {
58
- @keyframes p-component-overlay-enter-animation {
59
- from {
60
- background-color: transparent;
61
- }
62
- to {
63
- background-color: var(--maskbg);
64
- }
65
- }
66
-
67
- @keyframes p-component-overlay-leave-animation {
68
- from {
69
- background-color: var(--maskbg);
70
- }
71
- to {
72
- background-color: transparent;
73
- }
74
- }
1
+ * {
2
+ box-sizing: border-box;
3
+ }
4
+
5
+ .p-component {
6
+ font-family: var(--font-family);
7
+ font-feature-settings: var(--font-feature-settings, normal);
8
+ font-size: $fontSize;
9
+ font-weight: $fontWeight;
10
+ }
11
+
12
+ .p-component-overlay {
13
+ background-color: $maskBg;
14
+ transition-duration: $transitionDuration;
15
+ }
16
+
17
+ .p-disabled, .p-component:disabled {
18
+ opacity: $disabledOpacity;
19
+ background-color: $disabledBackground !important;
20
+ }
21
+
22
+ .p-error {
23
+ color: $errorColor;
24
+ }
25
+
26
+ .p-text-secondary {
27
+ color: $textSecondaryColor;
28
+ }
29
+
30
+ .pi {
31
+ font-size: $primeIconFontSize;
32
+ }
33
+
34
+ .p-icon {
35
+ width: $primeIconFontSize;
36
+ height: $primeIconFontSize;
37
+ }
38
+
39
+ .p-link {
40
+ font-family: var(--font-family);
41
+ font-feature-settings: var(--font-feature-settings, normal);
42
+ font-size: $fontSize;
43
+ border-radius: $borderRadius;
44
+
45
+ &:focus-visible {
46
+ @include focused();
47
+ }
48
+ }
49
+
50
+ .p-component-overlay-enter {
51
+ animation: p-component-overlay-enter-animation 150ms forwards;
52
+ }
53
+
54
+ .p-component-overlay-leave {
55
+ animation: p-component-overlay-leave-animation 150ms forwards;
56
+ }
57
+
58
+ .p-component-overlay {
59
+ @keyframes p-component-overlay-enter-animation {
60
+ from {
61
+ background-color: transparent;
62
+ }
63
+ to {
64
+ background-color: var(--maskbg);
65
+ }
66
+ }
67
+
68
+ @keyframes p-component-overlay-leave-animation {
69
+ from {
70
+ background-color: var(--maskbg);
71
+ }
72
+ to {
73
+ background-color: transparent;
74
+ }
75
+ }
75
76
  }
@@ -0,0 +1,2 @@
1
+ "use strict";var e=require("react"),t=require("primereact/utils"),r=require("primereact/inputswitch");const a=({children:r,...a})=>{const n={size:`box-size-${a.size??"100"}`,direction:`box-direction-${a.direction??"row"}`,justify:void 0===a.justify?"":Array.isArray(a.justify)?a.justify?.join(" "):a.justify,align:void 0===a.align?"":Array.isArray(a.align)?a.align?.join(" "):a.align},s={className:t.classNames(["box",a.className??"",n.size,n.direction,n.justify,n.align]),style:a.css,id:a.id};return e.createElement("div",{...s},r)},n=({iconPrefix:t="bi bi-",...r})=>r.label&&e.createElement("p",{className:"form-label"},r.icon&&e.createElement("i",{className:t+r.icon+" me-1"}),r.label,r.required&&e.createElement("span",{className:"text-danger"},"*")),s=({errors:t,name:r,...a})=>a.mode&&"Controlled"!==a.mode?e.createElement("div",{className:t[r??""]?"invalid-feedback is-invalid":"","data-name":r??"",id:"j_feedback",style:{display:t[r??""]?"block":"none"}},t[r??""]?t[r??""].message:""):e.createElement("div",{"data-name":r,id:"j_feedback"});var l=e=>null==e;var i=e=>!l(e)&&!Array.isArray(e)&&(e=>"object"==typeof e)(e)&&!(e=>e instanceof Date)(e),o=e=>i(e)&&e.target?"checkbox"===e.target.type?e.target.checked:e.target.value:e,c=e=>{const t=e.constructor&&e.constructor.prototype;return i(t)&&t.hasOwnProperty("isPrototypeOf")},u="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function d(e){let t;const r=Array.isArray(e),a="undefined"!=typeof FileList&&e instanceof FileList;if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else{if(u&&(e instanceof Blob||a)||!r&&!i(e))return e;if(t=r?[]:{},r||c(e))for(const r in e)e.hasOwnProperty(r)&&(t[r]=d(e[r]));else t=e}return t}var f=e=>Array.isArray(e)?e.filter(Boolean):[],m=e=>void 0===e,b=(e,t,r)=>{if(!t||!i(e))return r;const a=f(t.split(/[,[\].]+?/)).reduce(((e,t)=>l(e)?e:e[t]),e);return m(a)||a===e?m(e[t])?r:e[t]:a},y=e=>"boolean"==typeof e,g=(e,t,r)=>{let a=-1;const n=(e=>/^\w*$/.test(e))(t)?[t]:f(t.replace(/["|']|\]/g,"").split(/\.|\[/));const s=n.length,l=s-1;for(;++a<s;){const t=n[a];let s=r;if(a!==l){const r=e[t];s=i(r)||Array.isArray(r)?r:isNaN(+n[a+1])?{}:[]}if("__proto__"===t||"constructor"===t||"prototype"===t)return;e[t]=s,e=e[t]}return e};const p="blur",_="change",v="all",h=e.createContext(null),E=()=>e.useContext(h);var V=(e,t,r,a=!0)=>{const n={defaultValues:t._defaultValues};for(const s in e)Object.defineProperty(n,s,{get:()=>{const n=s;return t._proxyFormState[n]!==v&&(t._proxyFormState[n]=!a||v),r&&(r[n]=!0),e[n]}});return n},j=(e,t,r,a)=>{r(e);const{name:n,...s}=e;return i(l=s)&&!Object.keys(l).length||Object.keys(s).length>=Object.keys(t).length||Object.keys(s).find((e=>!0===t[e]));var l},x=(e,t,r)=>{return!e||!t||e===t||(a=e,Array.isArray(a)?a:[a]).some((e=>e&&(r?e===t:e.startsWith(t)||t.startsWith(e))));var a};function w(t){const r=e.useRef(t);r.current=t,e.useEffect((()=>{const e=!t.disabled&&r.current.subject&&r.current.subject.subscribe({next:r.current.next});return()=>{e&&e.unsubscribe()}}),[t.disabled])}var A=(e,t,r,a,n)=>"string"==typeof e?b(r,e,n):Array.isArray(e)?e.map((e=>b(r,e))):r;function F(t){const r=E(),{name:a,disabled:n,control:s=r.control,shouldUnregister:l}=t,i=((e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)))(s._names.array,a),c=function(t){const r=E(),{control:a=r.control,name:n,defaultValue:s,disabled:l,exact:i}=t||{},o=e.useRef(n);o.current=n,w({disabled:l,subject:a._subjects.values,next:e=>{x(o.current,e.name,i)&&u(d(A(o.current,a._names,e.values||a._formValues,!1,s)))}});const[c,u]=e.useState(a._getWatch(n,s));return e.useEffect((()=>a._removeUnmounted())),c}({control:s,name:a,defaultValue:b(s._formValues,a,b(s._defaultValues,a,t.defaultValue)),exact:!0}),u=function(t){const r=E(),{control:a=r.control,disabled:n,name:s,exact:l}=t||{},[i,o]=e.useState(a._formState),c=e.useRef(!0),u=e.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),d=e.useRef(s);return d.current=s,w({disabled:n,next:e=>c.current&&x(d.current,e.name,l)&&j(e,u.current,a._updateFormState)&&o({...a._formState,...e}),subject:a._subjects.state}),e.useEffect((()=>(c.current=!0,u.current.isValid&&a._updateValid(!0),()=>{c.current=!1})),[a]),e.useMemo((()=>V(i,a,u.current,!1)),[i,a])}({control:s,name:a,exact:!0}),f=e.useRef(s.register(a,{...t.rules,value:c,...y(t.disabled)?{disabled:t.disabled}:{}})),v=e.useMemo((()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!b(u.errors,a)},isDirty:{enumerable:!0,get:()=>!!b(u.dirtyFields,a)},isTouched:{enumerable:!0,get:()=>!!b(u.touchedFields,a)},isValidating:{enumerable:!0,get:()=>!!b(u.validatingFields,a)},error:{enumerable:!0,get:()=>b(u.errors,a)}})),[u,a]),h=e.useMemo((()=>({name:a,value:c,...y(n)||u.disabled?{disabled:u.disabled||n}:{},onChange:e=>f.current.onChange({target:{value:o(e),name:a},type:_}),onBlur:()=>f.current.onBlur({target:{value:b(s._formValues,a),name:a},type:p}),ref:e=>{const t=b(s._fields,a);t&&e&&(t._f.ref={focus:()=>e.focus(),select:()=>e.select(),setCustomValidity:t=>e.setCustomValidity(t),reportValidity:()=>e.reportValidity()})}})),[a,s._formValues,n,u.disabled,c,s._fields]);return e.useEffect((()=>{const e=s._options.shouldUnregister||l,t=(e,t)=>{const r=b(s._fields,e);r&&r._f&&(r._f.mount=t)};if(t(a,!0),e){const e=d(b(s._options.defaultValues,a));g(s._defaultValues,a,e),m(b(s._formValues,a))&&g(s._formValues,a,e)}return!i&&s.register(a),()=>{(i?e&&!s._state.action:e)?s.unregister(a):t(a,!1)}}),[a,s,i,l]),e.useEffect((()=>{s._updateDisabledField({disabled:n,fields:s._fields,name:a})}),[n,a,s]),e.useMemo((()=>({field:h,formState:u,fieldState:v})),[h,u,v])}const N=e=>e.render(F(e));function S({...t}){return e.createElement(N,{render:({field:a,formState:{errors:n}})=>e.createElement(e.Fragment,null,e.createElement("div",{className:"w-100 d-flex"},e.createElement(r.InputSwitch,{checked:a.value,disabled:t.disabled,falseValue:t.valueFalse??!1,id:t.id,name:a.name,trueValue:t.valueTrue??!0,onChange:e=>a.onChange(e)}),t.legend&&e.createElement("p",{className:"ms-2 p-inputswitch-legend"},t.legend)),e.createElement(s,{...t,errors:n})),control:t.control,name:t.name})}function k({...t}){return e.createElement(e.Fragment,null,e.createElement("div",{className:"w-100 d-flex"},e.createElement(r.InputSwitch,{checked:t.value,disabled:t.disabled,falseValue:t.valueFalse??!1,id:t.id,name:t.name,trueValue:t.valueTrue??!0,onChange:e=>t.onChange(e.target.value)}),t.legend&&e.createElement("p",{className:"ms-2 p-inputswitch-legend"},t.legend)),e.createElement(s,{...t}))}exports.Switch=function(t){let r=t;return e.createElement(a,{className:t.className,css:t.css,size:t.size??"100"},e.createElement(n,{...t}),t.mode&&"Controlled"!==t.mode?e.createElement(S,{...r}):e.createElement(k,{...r}))};
2
+ //# sourceMappingURL=index.cjs.js.map