@nori-ui/core 1.0.6 → 1.1.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.
Files changed (166) hide show
  1. package/dist/chunk-2UXKXUX2.js +286 -0
  2. package/dist/chunk-2UXKXUX2.js.map +1 -0
  3. package/dist/{chunk-DDGMLLS3.js → chunk-46OT4PA6.js} +3 -3
  4. package/dist/{chunk-DDGMLLS3.js.map → chunk-46OT4PA6.js.map} +1 -1
  5. package/dist/{chunk-SFNDR6DI.js → chunk-5BM6H2CD.js} +3 -3
  6. package/dist/{chunk-SFNDR6DI.js.map → chunk-5BM6H2CD.js.map} +1 -1
  7. package/dist/{chunk-EWWQQ5DB.js → chunk-6JVUVBZH.js} +5 -5
  8. package/dist/{chunk-EWWQQ5DB.js.map → chunk-6JVUVBZH.js.map} +1 -1
  9. package/dist/{chunk-FT2XBBQJ.js → chunk-6PO2IWB3.js} +8 -5
  10. package/dist/chunk-6PO2IWB3.js.map +1 -0
  11. package/dist/{chunk-YNKKEO2A.js → chunk-7D2BHQ6M.js} +3 -3
  12. package/dist/{chunk-YNKKEO2A.js.map → chunk-7D2BHQ6M.js.map} +1 -1
  13. package/dist/{chunk-MRJWPRCX.js → chunk-AFQIK6JI.js} +3 -3
  14. package/dist/{chunk-MRJWPRCX.js.map → chunk-AFQIK6JI.js.map} +1 -1
  15. package/dist/{chunk-IKLA2CVQ.js → chunk-C6TRLHMW.js} +21 -5
  16. package/dist/chunk-C6TRLHMW.js.map +1 -0
  17. package/dist/{chunk-NRYWNOG5.js → chunk-CGQIVFCN.js} +3 -3
  18. package/dist/{chunk-NRYWNOG5.js.map → chunk-CGQIVFCN.js.map} +1 -1
  19. package/dist/chunk-EFK7726V.js +104 -0
  20. package/dist/chunk-EFK7726V.js.map +1 -0
  21. package/dist/{chunk-3BDDPFCI.js → chunk-FDBQOQMW.js} +3 -3
  22. package/dist/{chunk-3BDDPFCI.js.map → chunk-FDBQOQMW.js.map} +1 -1
  23. package/dist/{chunk-XALU6LOT.js → chunk-GELLSU64.js} +3 -3
  24. package/dist/{chunk-XALU6LOT.js.map → chunk-GELLSU64.js.map} +1 -1
  25. package/dist/{chunk-BZLT6R62.js → chunk-GRDVE3IR.js} +3 -3
  26. package/dist/{chunk-BZLT6R62.js.map → chunk-GRDVE3IR.js.map} +1 -1
  27. package/dist/{chunk-OMU4R4Y5.js → chunk-HTF6FDB6.js} +3 -3
  28. package/dist/{chunk-OMU4R4Y5.js.map → chunk-HTF6FDB6.js.map} +1 -1
  29. package/dist/{chunk-X7APG7G2.js → chunk-HZKXPN6B.js} +154 -34
  30. package/dist/chunk-HZKXPN6B.js.map +1 -0
  31. package/dist/{chunk-WGT345SV.js → chunk-IGLMPAWE.js} +3 -3
  32. package/dist/{chunk-WGT345SV.js.map → chunk-IGLMPAWE.js.map} +1 -1
  33. package/dist/{chunk-5XEGZFG5.js → chunk-LWQZ257T.js} +3 -3
  34. package/dist/{chunk-5XEGZFG5.js.map → chunk-LWQZ257T.js.map} +1 -1
  35. package/dist/{chunk-RFW5SRZA.js → chunk-MJ4AGXS7.js} +3 -3
  36. package/dist/{chunk-RFW5SRZA.js.map → chunk-MJ4AGXS7.js.map} +1 -1
  37. package/dist/{chunk-PNP7L4TA.js → chunk-RM5TSXVE.js} +3 -3
  38. package/dist/{chunk-PNP7L4TA.js.map → chunk-RM5TSXVE.js.map} +1 -1
  39. package/dist/{chunk-MKSDYRWQ.js → chunk-SINLREQV.js} +3 -3
  40. package/dist/{chunk-MKSDYRWQ.js.map → chunk-SINLREQV.js.map} +1 -1
  41. package/dist/{chunk-TLS54G6Y.js → chunk-UF5OENHV.js} +3 -3
  42. package/dist/{chunk-TLS54G6Y.js.map → chunk-UF5OENHV.js.map} +1 -1
  43. package/dist/{chunk-ZQMNGPLE.js → chunk-UJ5KFRDE.js} +18 -6
  44. package/dist/chunk-UJ5KFRDE.js.map +1 -0
  45. package/dist/{chunk-SWC5CNKE.js → chunk-UPVNZPFV.js} +3 -3
  46. package/dist/{chunk-SWC5CNKE.js.map → chunk-UPVNZPFV.js.map} +1 -1
  47. package/dist/{chunk-3F4TXKDY.js → chunk-UUXWRDWW.js} +3 -3
  48. package/dist/chunk-UUXWRDWW.js.map +1 -0
  49. package/dist/{chunk-7GPDNQSX.js → chunk-V2AWSDDZ.js} +5 -5
  50. package/dist/{chunk-7GPDNQSX.js.map → chunk-V2AWSDDZ.js.map} +1 -1
  51. package/dist/{chunk-JQQ3FBN7.js → chunk-VCJF75T2.js} +3 -3
  52. package/dist/{chunk-JQQ3FBN7.js.map → chunk-VCJF75T2.js.map} +1 -1
  53. package/dist/{chunk-ZBW3BA5R.js → chunk-VMAGFYHG.js} +39 -4
  54. package/dist/chunk-VMAGFYHG.js.map +1 -0
  55. package/dist/{chunk-JZ774T7U.js → chunk-W3HMOOON.js} +3 -3
  56. package/dist/{chunk-JZ774T7U.js.map → chunk-W3HMOOON.js.map} +1 -1
  57. package/dist/{chunk-6AD6KCVB.js → chunk-WAKKQROH.js} +3 -3
  58. package/dist/{chunk-6AD6KCVB.js.map → chunk-WAKKQROH.js.map} +1 -1
  59. package/dist/{chunk-LVWNMQGR.js → chunk-WDNDTSNX.js} +5 -5
  60. package/dist/{chunk-LVWNMQGR.js.map → chunk-WDNDTSNX.js.map} +1 -1
  61. package/dist/chunk-WOF67PKT.js +60 -0
  62. package/dist/chunk-WOF67PKT.js.map +1 -0
  63. package/dist/{chunk-QJNV7YQP.js → chunk-WTNDPO2V.js} +39 -4
  64. package/dist/chunk-WTNDPO2V.js.map +1 -0
  65. package/dist/{chunk-FEPTH5RV.js → chunk-XP55RZ3D.js} +3 -3
  66. package/dist/{chunk-FEPTH5RV.js.map → chunk-XP55RZ3D.js.map} +1 -1
  67. package/dist/{chunk-CCUXO2HN.js → chunk-Y4ZRSW35.js} +3 -3
  68. package/dist/{chunk-CCUXO2HN.js.map → chunk-Y4ZRSW35.js.map} +1 -1
  69. package/dist/client.cjs +619 -123
  70. package/dist/client.cjs.map +1 -1
  71. package/dist/client.d.cts +2 -0
  72. package/dist/client.d.ts +2 -0
  73. package/dist/client.js +40 -38
  74. package/dist/client.js.map +1 -1
  75. package/dist/components/Accordion/index.js +2 -2
  76. package/dist/components/Alert/index.js +2 -2
  77. package/dist/components/AlertDialog/index.js +2 -2
  78. package/dist/components/Avatar/index.js +2 -2
  79. package/dist/components/Badge/index.js +2 -2
  80. package/dist/components/Box/index.js +4 -4
  81. package/dist/components/Breadcrumb/index.cjs +6 -3
  82. package/dist/components/Breadcrumb/index.cjs.map +1 -1
  83. package/dist/components/Breadcrumb/index.js +5 -5
  84. package/dist/components/Button/index.js +2 -2
  85. package/dist/components/Calendar/index.cjs +170 -35
  86. package/dist/components/Calendar/index.cjs.map +1 -1
  87. package/dist/components/Calendar/index.js +5 -5
  88. package/dist/components/Card/index.js +2 -2
  89. package/dist/components/Checkbox/index.cjs +36 -1
  90. package/dist/components/Checkbox/index.cjs.map +1 -1
  91. package/dist/components/Checkbox/index.d.cts +17 -1
  92. package/dist/components/Checkbox/index.d.ts +17 -1
  93. package/dist/components/Checkbox/index.js +2 -2
  94. package/dist/components/Dialog/index.js +2 -2
  95. package/dist/components/Field/index.cjs +703 -0
  96. package/dist/components/Field/index.cjs.map +1 -0
  97. package/dist/components/Field/index.d.cts +51 -0
  98. package/dist/components/Field/index.d.ts +51 -0
  99. package/dist/components/Field/index.js +9 -0
  100. package/dist/components/Field/index.js.map +1 -0
  101. package/dist/components/FloatButton/index.cjs +6 -3
  102. package/dist/components/FloatButton/index.cjs.map +1 -1
  103. package/dist/components/FloatButton/index.js +5 -5
  104. package/dist/components/HStack/index.js +4 -4
  105. package/dist/components/InputGroup/index.cjs.map +1 -1
  106. package/dist/components/InputGroup/index.d.cts +8 -1
  107. package/dist/components/InputGroup/index.d.ts +8 -1
  108. package/dist/components/InputGroup/index.js +2 -2
  109. package/dist/components/Label/index.cjs +458 -0
  110. package/dist/components/Label/index.cjs.map +1 -0
  111. package/dist/components/Label/index.d.cts +14 -0
  112. package/dist/components/Label/index.d.ts +14 -0
  113. package/dist/components/Label/index.js +8 -0
  114. package/dist/components/Label/index.js.map +1 -0
  115. package/dist/components/Pagination/index.cjs +21 -6
  116. package/dist/components/Pagination/index.cjs.map +1 -1
  117. package/dist/components/Pagination/index.js +5 -5
  118. package/dist/components/Popover/index.js +2 -2
  119. package/dist/components/Progress/index.js +2 -2
  120. package/dist/components/Radio/index.cjs +18 -2
  121. package/dist/components/Radio/index.cjs.map +1 -1
  122. package/dist/components/Radio/index.d.cts +17 -1
  123. package/dist/components/Radio/index.d.ts +17 -1
  124. package/dist/components/Radio/index.js +2 -2
  125. package/dist/components/SegmentedControl/index.js +2 -2
  126. package/dist/components/Select/index.cjs +15 -3
  127. package/dist/components/Select/index.cjs.map +1 -1
  128. package/dist/components/Select/index.d.cts +6 -0
  129. package/dist/components/Select/index.d.ts +6 -0
  130. package/dist/components/Select/index.js +2 -2
  131. package/dist/components/Switch/index.cjs +36 -1
  132. package/dist/components/Switch/index.cjs.map +1 -1
  133. package/dist/components/Switch/index.d.cts +17 -1
  134. package/dist/components/Switch/index.d.ts +17 -1
  135. package/dist/components/Switch/index.js +2 -2
  136. package/dist/components/Tabs/index.js +2 -2
  137. package/dist/components/Text/index.js +2 -2
  138. package/dist/components/TextArea/index.cjs +35 -84
  139. package/dist/components/TextArea/index.cjs.map +1 -1
  140. package/dist/components/TextArea/index.js +3 -3
  141. package/dist/components/TextInput/index.cjs +35 -84
  142. package/dist/components/TextInput/index.cjs.map +1 -1
  143. package/dist/components/TextInput/index.d.cts +7 -8
  144. package/dist/components/TextInput/index.d.ts +7 -8
  145. package/dist/components/TextInput/index.js +2 -2
  146. package/dist/components/Toggle/index.js +2 -2
  147. package/dist/components/Tooltip/index.js +2 -2
  148. package/dist/components/VStack/index.js +4 -4
  149. package/dist/i18n/index.cjs +6 -3
  150. package/dist/i18n/index.cjs.map +1 -1
  151. package/dist/i18n/index.js +1 -1
  152. package/dist/index.cjs +619 -123
  153. package/dist/index.cjs.map +1 -1
  154. package/dist/index.d.cts +2 -0
  155. package/dist/index.d.ts +2 -0
  156. package/dist/index.js +37 -35
  157. package/package.json +8 -1
  158. package/dist/chunk-3F4TXKDY.js.map +0 -1
  159. package/dist/chunk-FT2XBBQJ.js.map +0 -1
  160. package/dist/chunk-IKLA2CVQ.js.map +0 -1
  161. package/dist/chunk-QJNV7YQP.js.map +0 -1
  162. package/dist/chunk-X7APG7G2.js.map +0 -1
  163. package/dist/chunk-ZBW3BA5R.js.map +0 -1
  164. package/dist/chunk-ZQMNGPLE.js.map +0 -1
  165. package/dist/chunk-ZRD4FQBT.js +0 -153
  166. package/dist/chunk-ZRD4FQBT.js.map +0 -1
@@ -0,0 +1,703 @@
1
+ 'use strict';
2
+
3
+ var react = require('react');
4
+ var reactNative = require('react-native');
5
+ var jsxRuntime = require('nativewind/jsx-runtime');
6
+
7
+ var __defProp = Object.defineProperty;
8
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
9
+
10
+ // src/i18n/default-dictionary.ts
11
+ var defaultDictionary = {
12
+ // generic / shared
13
+ "common.cancel": "Cancel",
14
+ "common.confirm": "Confirm",
15
+ "common.close": "Close",
16
+ "common.back": "Back",
17
+ "common.loading": "Loading",
18
+ "common.error": "Something went wrong",
19
+ "common.retry": "Try again",
20
+ // breadcrumb
21
+ "breadcrumb.ariaLabel": "Breadcrumb",
22
+ "breadcrumb.expandLabel": "Show full path",
23
+ "breadcrumb.ellipsisLabel": "More",
24
+ "breadcrumb.currentPageLabel": "Current page",
25
+ "breadcrumb.siblingMenuLabel": "Open sibling pages",
26
+ // pagination
27
+ "pagination.ariaLabel": "Pagination",
28
+ "pagination.previous": "Previous page",
29
+ "pagination.next": "Next page",
30
+ "pagination.first": "First page",
31
+ "pagination.last": "Last page",
32
+ "pagination.ellipsis": "More pages",
33
+ "pagination.currentPage": "Current page",
34
+ "pagination.gotoPage": "Go to page {{page}}",
35
+ "pagination.range": "Showing {{from}}\u2013{{to}} of {{total}}",
36
+ "pagination.pageOf": "Page {{page}} of {{total}}",
37
+ "pagination.pageSizeLabel": "Items per page",
38
+ "pagination.jumperLabel": "Go to page",
39
+ "pagination.jumperPlaceholder": "#",
40
+ // floatButton
41
+ "floatButton.backToTop": "Back to top",
42
+ // calendar
43
+ "calendar.header.previous": "Previous month",
44
+ "calendar.header.next": "Next month",
45
+ "calendar.header.openMonthView": "Open month picker",
46
+ "calendar.header.openYearView": "Open year picker",
47
+ "calendar.header.openDayView": "Open day picker",
48
+ "calendar.today": "Today",
49
+ "calendar.clear": "Clear",
50
+ // button
51
+ "button.loadingLabel": "Loading",
52
+ // input
53
+ "input.clear": "Clear",
54
+ "input.passwordShow": "Show password",
55
+ "input.passwordHide": "Hide password",
56
+ // checkbox / switch
57
+ "checkbox.checked": "Checked",
58
+ "checkbox.unchecked": "Unchecked",
59
+ "switch.on": "On",
60
+ "switch.off": "Off",
61
+ // field
62
+ "field.requiredIndicator": "*",
63
+ "field.requiredLabel": "required"
64
+ };
65
+
66
+ // src/i18n/resolve.ts
67
+ function resolveI18n(input, defaults) {
68
+ if (typeof input === "function") {
69
+ return (keyOrKeys, options) => input(keyOrKeys, options);
70
+ }
71
+ const dict = input ?? {};
72
+ return (keyOrKeys, options) => {
73
+ const keys = Array.isArray(keyOrKeys) ? keyOrKeys : [keyOrKeys];
74
+ for (const rawKey of keys) {
75
+ const key = pluralize(rawKey, options?.count);
76
+ const template = dict[key] ?? defaults[key];
77
+ if (template !== void 0) {
78
+ return interpolate(template, options);
79
+ }
80
+ }
81
+ const lastKey = keys[keys.length - 1];
82
+ if (options?.defaultValue !== void 0) {
83
+ return interpolate(options.defaultValue, options);
84
+ }
85
+ return lastKey ?? "";
86
+ };
87
+ }
88
+ __name(resolveI18n, "resolveI18n");
89
+ function pluralize(key, count) {
90
+ if (count === void 0) {
91
+ return key;
92
+ }
93
+ if (count === 1) {
94
+ return `${key}_one`;
95
+ }
96
+ return `${key}_other`;
97
+ }
98
+ __name(pluralize, "pluralize");
99
+ function interpolate(template, options) {
100
+ if (!options) {
101
+ return template;
102
+ }
103
+ return template.replace(/\{\{\s*([A-Za-z0-9_.-]+)\s*\}\}/g, (_match, name) => {
104
+ const value = options[name];
105
+ return value === void 0 || value === null ? "" : String(value);
106
+ });
107
+ }
108
+ __name(interpolate, "interpolate");
109
+ var defaultValue = {
110
+ t: resolveI18n(void 0, defaultDictionary)
111
+ };
112
+ var I18nContext = react.createContext(defaultValue);
113
+ I18nContext.displayName = "I18nContext";
114
+
115
+ // src/i18n/use-translation.ts
116
+ function useTranslation() {
117
+ return react.useContext(I18nContext);
118
+ }
119
+ __name(useTranslation, "useTranslation");
120
+
121
+ // src/theme/px.ts
122
+ function px(value) {
123
+ if (typeof value === "number") {
124
+ return value;
125
+ }
126
+ const n = Number.parseFloat(value);
127
+ return Number.isFinite(n) ? n : 0;
128
+ }
129
+ __name(px, "px");
130
+
131
+ // ../tokens/build/theme.ts
132
+ var theme = {
133
+ color: {
134
+ danger: "#ef4444",
135
+ info: "#3b82f6",
136
+ neutral: {
137
+ "100": "#f4f4f5",
138
+ "200": "#e4e4e7",
139
+ "300": "#d4d4d8",
140
+ "400": "#a1a1aa",
141
+ "50": "#fafafa",
142
+ "500": "#71717a",
143
+ "600": "#52525b",
144
+ "700": "#3f3f46",
145
+ "800": "#27272a",
146
+ "900": "#18181b"
147
+ },
148
+ primary: {
149
+ "100": "#ccfbf1",
150
+ "200": "#99f6e4",
151
+ "300": "#5eead4",
152
+ "400": "#2dd4bf",
153
+ "50": "#f0fdfa",
154
+ "500": "#14b8a6",
155
+ "600": "#0d9488",
156
+ "700": "#0f766e",
157
+ "800": "#115e59",
158
+ "900": "#134e4a"
159
+ },
160
+ success: "#22c55e",
161
+ warning: "#f59e0b"
162
+ },
163
+ fontFamily: {
164
+ body: "system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif",
165
+ display: "ui-serif, Georgia, 'Times New Roman', serif",
166
+ mono: "ui-monospace, 'SF Mono', Menlo, Consolas, 'DejaVu Sans Mono', monospace"
167
+ },
168
+ fontSize: {
169
+ "2xl": "24px",
170
+ "3xl": "30px",
171
+ "4xl": "36px",
172
+ lg: "18px",
173
+ md: "16px",
174
+ sm: "14px",
175
+ xl: "20px",
176
+ xs: "12px"
177
+ },
178
+ fontWeight: {
179
+ bold: "700",
180
+ medium: "500",
181
+ regular: "400",
182
+ semibold: "600"
183
+ },
184
+ lineHeight: {
185
+ normal: "1.4",
186
+ relaxed: "1.6",
187
+ tight: "1.2"
188
+ },
189
+ radius: {
190
+ "2xl": "16px",
191
+ full: "9999px",
192
+ lg: "8px",
193
+ md: "6px",
194
+ none: "0px",
195
+ sm: "4px",
196
+ xl: "12px"
197
+ },
198
+ semantic: {
199
+ background: {
200
+ default: "#fafafa",
201
+ elevated: "#ffffff",
202
+ subtle: "#f4f4f5"
203
+ },
204
+ border: {
205
+ default: "#e4e4e7",
206
+ strong: "#d4d4d8"
207
+ },
208
+ interactive: {
209
+ destructive: "#ef4444",
210
+ primary: "#0d9488",
211
+ primaryHover: "#0f766e",
212
+ primaryPressed: "#115e59"
213
+ },
214
+ text: {
215
+ default: "#18181b",
216
+ inverted: "#fafafa",
217
+ muted: "#52525b"
218
+ }
219
+ },
220
+ shadow: {
221
+ lg: "0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)",
222
+ md: "0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1)",
223
+ sm: "0 1px 2px 0 rgba(0, 0, 0, 0.05)"
224
+ },
225
+ spacing: {
226
+ "0": "0px",
227
+ "1": "4px",
228
+ "10": "40px",
229
+ "12": "48px",
230
+ "16": "64px",
231
+ "2": "8px",
232
+ "20": "80px",
233
+ "24": "96px",
234
+ "3": "12px",
235
+ "4": "16px",
236
+ "5": "20px",
237
+ "6": "24px",
238
+ "8": "32px"
239
+ }
240
+ };
241
+ var themeDark = {
242
+ color: {
243
+ danger: "#ef4444",
244
+ info: "#3b82f6",
245
+ neutral: {
246
+ "100": "#f4f4f5",
247
+ "200": "#e4e4e7",
248
+ "300": "#d4d4d8",
249
+ "400": "#a1a1aa",
250
+ "50": "#fafafa",
251
+ "500": "#71717a",
252
+ "600": "#52525b",
253
+ "700": "#3f3f46",
254
+ "800": "#27272a",
255
+ "900": "#18181b"
256
+ },
257
+ primary: {
258
+ "100": "#ccfbf1",
259
+ "200": "#99f6e4",
260
+ "300": "#5eead4",
261
+ "400": "#2dd4bf",
262
+ "50": "#f0fdfa",
263
+ "500": "#14b8a6",
264
+ "600": "#0d9488",
265
+ "700": "#0f766e",
266
+ "800": "#115e59",
267
+ "900": "#134e4a"
268
+ },
269
+ success: "#22c55e",
270
+ warning: "#f59e0b"
271
+ },
272
+ fontFamily: {
273
+ body: "system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif",
274
+ display: "ui-serif, Georgia, 'Times New Roman', serif",
275
+ mono: "ui-monospace, 'SF Mono', Menlo, Consolas, 'DejaVu Sans Mono', monospace"
276
+ },
277
+ fontSize: {
278
+ "2xl": "24px",
279
+ "3xl": "30px",
280
+ "4xl": "36px",
281
+ lg: "18px",
282
+ md: "16px",
283
+ sm: "14px",
284
+ xl: "20px",
285
+ xs: "12px"
286
+ },
287
+ fontWeight: {
288
+ bold: "700",
289
+ medium: "500",
290
+ regular: "400",
291
+ semibold: "600"
292
+ },
293
+ lineHeight: {
294
+ normal: "1.4",
295
+ relaxed: "1.6",
296
+ tight: "1.2"
297
+ },
298
+ radius: {
299
+ "2xl": "16px",
300
+ full: "9999px",
301
+ lg: "8px",
302
+ md: "6px",
303
+ none: "0px",
304
+ sm: "4px",
305
+ xl: "12px"
306
+ },
307
+ semantic: {
308
+ background: {
309
+ default: "#18181b",
310
+ elevated: "#3f3f46",
311
+ subtle: "#27272a"
312
+ },
313
+ border: {
314
+ default: "#3f3f46",
315
+ strong: "#52525b"
316
+ },
317
+ interactive: {
318
+ destructive: "#ef4444",
319
+ primary: "#2dd4bf",
320
+ primaryHover: "#5eead4",
321
+ primaryPressed: "#99f6e4"
322
+ },
323
+ text: {
324
+ default: "#fafafa",
325
+ inverted: "#18181b",
326
+ muted: "#a1a1aa"
327
+ }
328
+ },
329
+ shadow: {
330
+ lg: "0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)",
331
+ md: "0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1)",
332
+ sm: "0 1px 2px 0 rgba(0, 0, 0, 0.05)"
333
+ },
334
+ spacing: {
335
+ "0": "0px",
336
+ "1": "4px",
337
+ "10": "40px",
338
+ "12": "48px",
339
+ "16": "64px",
340
+ "2": "8px",
341
+ "20": "80px",
342
+ "24": "96px",
343
+ "3": "12px",
344
+ "4": "16px",
345
+ "5": "20px",
346
+ "6": "24px",
347
+ "8": "32px"
348
+ }
349
+ };
350
+ var defaultTheme = {
351
+ light: theme,
352
+ dark: themeDark
353
+ };
354
+ var ThemeContext = react.createContext(defaultTheme);
355
+ ThemeContext.displayName = "ThemeContext";
356
+ var ColorSchemeOverrideContext = react.createContext(null);
357
+ ColorSchemeOverrideContext.displayName = "ColorSchemeOverrideContext";
358
+ var isWeb = reactNative.Platform.OS === "web";
359
+ function readWebScheme() {
360
+ if (typeof document === "undefined") {
361
+ return "light";
362
+ }
363
+ const root = document.documentElement;
364
+ if (root.classList.contains("dark")) {
365
+ return "dark";
366
+ }
367
+ if (root.getAttribute("data-theme") === "dark") {
368
+ return "dark";
369
+ }
370
+ return "light";
371
+ }
372
+ __name(readWebScheme, "readWebScheme");
373
+ function useColorScheme() {
374
+ const override = react.useContext(ColorSchemeOverrideContext);
375
+ const [scheme, setScheme] = react.useState(() => {
376
+ if (isWeb) {
377
+ return readWebScheme();
378
+ }
379
+ return reactNative.Appearance.getColorScheme() ?? "light";
380
+ });
381
+ react.useEffect(() => {
382
+ if (isWeb) {
383
+ const root = document.documentElement;
384
+ const update = /* @__PURE__ */ __name(() => setScheme(readWebScheme()), "update");
385
+ const observer = new MutationObserver(update);
386
+ observer.observe(root, { attributes: true, attributeFilter: ["class", "data-theme"] });
387
+ update();
388
+ return () => observer.disconnect();
389
+ }
390
+ const sub = reactNative.Appearance.addChangeListener(({ colorScheme }) => {
391
+ setScheme(colorScheme ?? "light");
392
+ });
393
+ return () => sub.remove();
394
+ }, []);
395
+ return override ?? scheme;
396
+ }
397
+ __name(useColorScheme, "useColorScheme");
398
+
399
+ // src/theme/use-theme-colors.ts
400
+ function useThemeColors() {
401
+ const scheme = useColorScheme();
402
+ const themePair = react.useContext(ThemeContext);
403
+ return scheme === "dark" ? themePair.dark : themePair.light;
404
+ }
405
+ __name(useThemeColors, "useThemeColors");
406
+ var SIZE_MAP = {
407
+ sm: 12,
408
+ md: 16,
409
+ lg: 24,
410
+ xl: 32
411
+ };
412
+ var Spinner = /* @__PURE__ */ __name(({ label = "Loading", size = "md", testID, color, style, ...rest }) => {
413
+ const px2 = typeof size === "number" ? size : SIZE_MAP[size];
414
+ return /* @__PURE__ */ jsxRuntime.jsx(
415
+ reactNative.ActivityIndicator,
416
+ {
417
+ ...rest,
418
+ ...testID !== void 0 ? { testID } : {},
419
+ accessibilityRole: "progressbar",
420
+ accessibilityLabel: label,
421
+ ...color !== void 0 ? { color } : {},
422
+ size: px2,
423
+ style: [{ width: px2, height: px2 }, style]
424
+ }
425
+ );
426
+ }, "Spinner");
427
+ var FieldContext = react.createContext(null);
428
+ var useFieldContextStrict = /* @__PURE__ */ __name((caller) => {
429
+ const ctx = react.useContext(FieldContext);
430
+ if (!ctx) {
431
+ throw new Error(`[Field] ${caller} must be used inside <Field> or <Field.Group>.`);
432
+ }
433
+ return ctx;
434
+ }, "useFieldContextStrict");
435
+ var childHasDisplayName = /* @__PURE__ */ __name((child, name) => {
436
+ if (!react.isValidElement(child)) {
437
+ return false;
438
+ }
439
+ const t = child.type;
440
+ return typeof t !== "string" && t?.displayName === name;
441
+ }, "childHasDisplayName");
442
+ var COMPOUND_DISPLAY_NAMES = ["Field.Label", "Field.Description", "Field.Error", "Field.Control"];
443
+ var isCompoundChild = /* @__PURE__ */ __name((child) => COMPOUND_DISPLAY_NAMES.some((name) => childHasDisplayName(child, name)), "isCompoundChild");
444
+ var FieldRoot = /* @__PURE__ */ __name(({
445
+ name,
446
+ required = false,
447
+ disabled = false,
448
+ error = null,
449
+ label,
450
+ description,
451
+ validating = false,
452
+ orientation = "vertical",
453
+ id,
454
+ children,
455
+ className,
456
+ testID,
457
+ isGroup = false
458
+ }) => {
459
+ const colors = useThemeColors();
460
+ const reactId = react.useId();
461
+ const fieldId = id ?? `nori-ui-field-${reactId}`;
462
+ const labelId = `${fieldId}-label`;
463
+ const descriptionId = `${fieldId}-desc`;
464
+ const errorId = `${fieldId}-error`;
465
+ const isCompoundMode = react.useMemo(() => {
466
+ let found = false;
467
+ react.Children.forEach(children, (child) => {
468
+ if (isCompoundChild(child)) {
469
+ found = true;
470
+ }
471
+ });
472
+ return found;
473
+ }, [children]);
474
+ const hasDescription = react.useMemo(() => {
475
+ if (!isCompoundMode) {
476
+ return description !== void 0 && description !== null && description !== false && description !== "";
477
+ }
478
+ let found = false;
479
+ react.Children.forEach(children, (child) => {
480
+ if (childHasDisplayName(child, "Field.Description")) {
481
+ found = true;
482
+ }
483
+ });
484
+ return found;
485
+ }, [isCompoundMode, description, children]);
486
+ const hasError = react.useMemo(() => {
487
+ if (!isCompoundMode) {
488
+ return Boolean(error);
489
+ }
490
+ let found = false;
491
+ react.Children.forEach(children, (child) => {
492
+ if (childHasDisplayName(child, "Field.Error") && react.isValidElement(child)) {
493
+ const el = child;
494
+ if (el.props.children !== void 0 && el.props.children !== null && el.props.children !== false && el.props.children !== "") {
495
+ found = true;
496
+ }
497
+ }
498
+ });
499
+ if (!found && error !== null && error !== void 0 && error !== false && error !== "") {
500
+ found = true;
501
+ }
502
+ return found;
503
+ }, [isCompoundMode, error, children]);
504
+ const describedBy = react.useMemo(() => {
505
+ const ids = [];
506
+ if (hasDescription) {
507
+ ids.push(descriptionId);
508
+ }
509
+ if (hasError) {
510
+ ids.push(errorId);
511
+ }
512
+ return ids.length === 0 ? void 0 : ids.join(" ");
513
+ }, [hasDescription, hasError, descriptionId, errorId]);
514
+ const value = {
515
+ fieldId,
516
+ labelId,
517
+ descriptionId,
518
+ errorId,
519
+ hasError,
520
+ hasDescription,
521
+ describedBy,
522
+ disabled,
523
+ required,
524
+ validating,
525
+ ...name !== void 0 ? { name } : {},
526
+ // In compound mode pass `error` (string) so Field.Error can fall back to it.
527
+ // In shorthand mode the error prop may be ReactNode; only pass when it is a string/null.
528
+ ...error !== null && error !== void 0 && typeof error === "string" ? { error } : {},
529
+ isGroup
530
+ };
531
+ const warnedRef = react.useRef(false);
532
+ react.useEffect(() => {
533
+ if (process.env.NODE_ENV === "production" || warnedRef.current) {
534
+ return;
535
+ }
536
+ const hasShorthand = label !== void 0 || description !== void 0 || error !== void 0;
537
+ if (hasShorthand && isCompoundMode) {
538
+ warnedRef.current = true;
539
+ console.warn(
540
+ "[Field] Mixing shorthand props (label/description/error) with compound children (Field.Label/Field.Description/Field.Error) is not supported. The compound children will win. To suppress this warning, use only one mode."
541
+ );
542
+ }
543
+ }, [label, description, error, isCompoundMode]);
544
+ const containerStyle = orientation === "horizontal" ? {
545
+ flexDirection: "row",
546
+ alignItems: "flex-start",
547
+ gap: px(colors.spacing["3"])
548
+ } : { flexDirection: "column", gap: px(colors.spacing["1"]) };
549
+ const containerExtra = {};
550
+ if (testID !== void 0) {
551
+ containerExtra.testID = testID;
552
+ }
553
+ containerExtra["data-orientation"] = orientation;
554
+ if (isGroup) {
555
+ containerExtra.role = "group";
556
+ containerExtra["aria-labelledby"] = labelId;
557
+ containerExtra.accessibilityRole = "none";
558
+ }
559
+ if (validating) {
560
+ containerExtra["data-validating"] = "";
561
+ containerExtra["aria-busy"] = true;
562
+ }
563
+ const renderShorthand = /* @__PURE__ */ __name(() => {
564
+ const childArray = react.Children.toArray(children);
565
+ const controlChild = childArray.length === 1 && react.isValidElement(childArray[0]) ? childArray[0] : null;
566
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
567
+ label !== void 0 && label !== null && label !== false ? /* @__PURE__ */ jsxRuntime.jsx(FieldLabel, { children: label }) : null,
568
+ description !== void 0 && description !== null && description !== false && description !== "" ? /* @__PURE__ */ jsxRuntime.jsx(FieldDescription, { children: description }) : null,
569
+ controlChild !== null ? /* @__PURE__ */ jsxRuntime.jsx(FieldControl, { children: controlChild }) : children,
570
+ error !== void 0 && error !== null && error !== false && error !== "" ? /* @__PURE__ */ jsxRuntime.jsx(FieldError, { children: error }) : null
571
+ ] });
572
+ }, "renderShorthand");
573
+ return /* @__PURE__ */ jsxRuntime.jsx(FieldContext.Provider, { value, children: /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: containerStyle, ...className !== void 0 ? { className } : {}, ...containerExtra, children: [
574
+ isCompoundMode ? children : renderShorthand(),
575
+ validating ? /* @__PURE__ */ jsxRuntime.jsx(Spinner, { size: "sm" }) : null
576
+ ] }) });
577
+ }, "FieldRoot");
578
+ var FieldLabel = /* @__PURE__ */ __name(({ children }) => {
579
+ const ctx = useFieldContextStrict("Field.Label");
580
+ const colors = useThemeColors();
581
+ const { t } = useTranslation();
582
+ const requiredIndicator = t("field.requiredIndicator");
583
+ const requiredLabel = t("field.requiredLabel");
584
+ const focusInput = /* @__PURE__ */ __name(() => {
585
+ if (typeof document !== "undefined") {
586
+ const el = document.getElementById(ctx.fieldId);
587
+ if (el && typeof el.focus === "function") {
588
+ el.focus();
589
+ }
590
+ }
591
+ }, "focusInput");
592
+ return /* @__PURE__ */ jsxRuntime.jsx(reactNative.Pressable, { onPress: focusInput, accessibilityRole: "none", disabled: ctx.disabled, children: /* @__PURE__ */ jsxRuntime.jsxs(
593
+ reactNative.Text,
594
+ {
595
+ nativeID: ctx.labelId,
596
+ ...{ id: ctx.labelId },
597
+ accessibilityRole: "text",
598
+ style: {
599
+ fontFamily: colors.fontFamily.body,
600
+ fontSize: px(colors.fontSize.sm),
601
+ fontWeight: colors.fontWeight.medium,
602
+ color: ctx.disabled ? colors.semantic.text.muted : colors.semantic.text.default
603
+ },
604
+ children: [
605
+ children,
606
+ ctx.required ? /* @__PURE__ */ jsxRuntime.jsx(
607
+ reactNative.Text,
608
+ {
609
+ accessibilityLabel: requiredLabel,
610
+ ...{ "aria-label": requiredLabel },
611
+ style: { color: colors.color.danger },
612
+ children: ` ${requiredIndicator}`
613
+ }
614
+ ) : null
615
+ ]
616
+ }
617
+ ) });
618
+ }, "FieldLabel");
619
+ FieldLabel.displayName = "Field.Label";
620
+ var FieldControl = /* @__PURE__ */ __name(({ children }) => {
621
+ const ctx = useFieldContextStrict("Field.Control");
622
+ if (react.Children.count(children) !== 1 || !react.isValidElement(children)) {
623
+ throw new Error("[Field.Control] expects exactly one child element.");
624
+ }
625
+ const child = children;
626
+ const merged = {
627
+ id: child.props.id ?? ctx.fieldId,
628
+ accessibilityLabelledBy: ctx.labelId,
629
+ "aria-labelledby": ctx.labelId
630
+ };
631
+ if (ctx.name !== void 0 && child.props.name === void 0) {
632
+ merged.name = ctx.name;
633
+ }
634
+ if (ctx.describedBy !== void 0) {
635
+ merged["aria-describedby"] = ctx.describedBy;
636
+ merged.accessibilityDescribedBy = ctx.describedBy;
637
+ }
638
+ if (ctx.hasError) {
639
+ merged["aria-invalid"] = true;
640
+ }
641
+ if (ctx.required) {
642
+ merged["aria-required"] = true;
643
+ }
644
+ if (ctx.disabled || child.props.disabled) {
645
+ merged.disabled = true;
646
+ }
647
+ return react.cloneElement(child, merged);
648
+ }, "FieldControl");
649
+ FieldControl.displayName = "Field.Control";
650
+ var FieldDescription = /* @__PURE__ */ __name(({ children }) => {
651
+ const ctx = useFieldContextStrict("Field.Description");
652
+ const colors = useThemeColors();
653
+ return /* @__PURE__ */ jsxRuntime.jsx(
654
+ reactNative.Text,
655
+ {
656
+ nativeID: ctx.descriptionId,
657
+ ...{ id: ctx.descriptionId },
658
+ style: {
659
+ fontFamily: colors.fontFamily.body,
660
+ fontSize: px(colors.fontSize.sm),
661
+ color: colors.semantic.text.muted
662
+ },
663
+ children
664
+ }
665
+ );
666
+ }, "FieldDescription");
667
+ FieldDescription.displayName = "Field.Description";
668
+ var FieldError = /* @__PURE__ */ __name(({ children }) => {
669
+ const ctx = useFieldContextStrict("Field.Error");
670
+ const colors = useThemeColors();
671
+ const content = children ?? ctx.error;
672
+ if (content === null || content === void 0 || content === "" || content === false) {
673
+ return null;
674
+ }
675
+ return /* @__PURE__ */ jsxRuntime.jsx(
676
+ reactNative.Text,
677
+ {
678
+ nativeID: ctx.errorId,
679
+ ...{ id: ctx.errorId, role: "alert" },
680
+ accessibilityRole: "text",
681
+ style: {
682
+ fontFamily: colors.fontFamily.body,
683
+ fontSize: px(colors.fontSize.sm),
684
+ color: colors.color.danger
685
+ },
686
+ children: content
687
+ }
688
+ );
689
+ }, "FieldError");
690
+ FieldError.displayName = "Field.Error";
691
+ var FieldGroup = /* @__PURE__ */ __name((props) => /* @__PURE__ */ jsxRuntime.jsx(FieldRoot, { ...props, isGroup: true }), "FieldGroup");
692
+ FieldGroup.displayName = "Field.Group";
693
+ var Field = Object.assign(FieldRoot, {
694
+ Label: FieldLabel,
695
+ Description: FieldDescription,
696
+ Control: FieldControl,
697
+ Error: FieldError,
698
+ Group: FieldGroup
699
+ });
700
+
701
+ exports.Field = Field;
702
+ //# sourceMappingURL=index.cjs.map
703
+ //# sourceMappingURL=index.cjs.map