powell-react 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (336) hide show
  1. package/.storybook/main.ts +28 -0
  2. package/.storybook/preview.scss +13 -0
  3. package/.storybook/preview.tsx +24 -0
  4. package/README.md +0 -0
  5. package/dist/cjs/index.js +1 -0
  6. package/dist/cjs/types/src/components/Button/Button.d.ts +6 -0
  7. package/dist/cjs/types/src/components/Button/index.d.ts +1 -0
  8. package/dist/cjs/types/src/components/index.d.ts +1 -0
  9. package/dist/cjs/types/src/index.d.ts +1 -0
  10. package/dist/cjs/types/src/powell/api/PowellProvider.d.ts +5 -0
  11. package/dist/cjs/types/src/powell/api/configService.d.ts +2 -0
  12. package/dist/cjs/types/src/powell/api/forms.d.ts +73 -0
  13. package/dist/cjs/types/src/powell/api/index.d.ts +5 -0
  14. package/dist/cjs/types/src/powell/api/powellDefaults.d.ts +2 -0
  15. package/dist/cjs/types/src/powell/api/primereact.d.ts +968 -0
  16. package/dist/cjs/types/src/powell/components/AutoComplete/AutoComplete.d.ts +24 -0
  17. package/dist/cjs/types/src/powell/components/AutoComplete/index.d.ts +1 -0
  18. package/dist/cjs/types/src/powell/components/Button/Button.d.ts +22 -0
  19. package/dist/cjs/types/src/powell/components/Button/index.d.ts +1 -0
  20. package/dist/cjs/types/src/powell/components/CascadeSelect/CascadeSelect.d.ts +24 -0
  21. package/dist/cjs/types/src/powell/components/CascadeSelect/index.d.ts +1 -0
  22. package/dist/cjs/types/src/powell/components/Checkbox/Checkbox.d.ts +21 -0
  23. package/dist/cjs/types/src/powell/components/Checkbox/index.d.ts +1 -0
  24. package/dist/cjs/types/src/powell/components/Chips/Chips.d.ts +23 -0
  25. package/dist/cjs/types/src/powell/components/Chips/index.d.ts +1 -0
  26. package/dist/cjs/types/src/powell/components/ColorPicker/ColorPicker.d.ts +24 -0
  27. package/dist/cjs/types/src/powell/components/ColorPicker/index.d.ts +1 -0
  28. package/dist/cjs/types/src/powell/components/Dropdown/Dropdown.d.ts +24 -0
  29. package/dist/cjs/types/src/powell/components/Dropdown/index.d.ts +1 -0
  30. package/dist/cjs/types/src/powell/components/Editor/Editor.d.ts +23 -0
  31. package/dist/cjs/types/src/powell/components/Editor/index.d.ts +1 -0
  32. package/dist/cjs/types/src/powell/components/FormContainer/FormContainer.d.ts +7 -0
  33. package/dist/cjs/types/src/powell/components/FormContainer/FormContext.d.ts +4 -0
  34. package/dist/cjs/types/src/powell/components/FormContainer/index.d.ts +2 -0
  35. package/dist/cjs/types/src/powell/components/InputMask/InputMask.d.ts +24 -0
  36. package/dist/cjs/types/src/powell/components/InputMask/index.d.ts +1 -0
  37. package/dist/cjs/types/src/powell/components/InputNumber/InputNumber.d.ts +24 -0
  38. package/dist/cjs/types/src/powell/components/InputNumber/index.d.ts +1 -0
  39. package/dist/cjs/types/src/powell/components/InputOtp/InputOtp.d.ts +21 -0
  40. package/dist/cjs/types/src/powell/components/InputOtp/index.d.ts +1 -0
  41. package/dist/cjs/types/src/powell/components/InputPassword/InputPassword.d.ts +23 -0
  42. package/dist/cjs/types/src/powell/components/InputPassword/index.d.ts +1 -0
  43. package/dist/cjs/types/src/powell/components/InputSwitch/InputSwitch.d.ts +21 -0
  44. package/dist/cjs/types/src/powell/components/InputSwitch/index.d.ts +1 -0
  45. package/dist/cjs/types/src/powell/components/InputText/InputText.d.ts +24 -0
  46. package/dist/cjs/types/src/powell/components/InputText/index.d.ts +1 -0
  47. package/dist/cjs/types/src/powell/components/InputTextarea/InputTextarea.d.ts +23 -0
  48. package/dist/cjs/types/src/powell/components/InputTextarea/index.d.ts +1 -0
  49. package/dist/cjs/types/src/powell/components/Knob/Knob.d.ts +20 -0
  50. package/dist/cjs/types/src/powell/components/Knob/index.d.ts +1 -0
  51. package/dist/cjs/types/src/powell/components/ListBox/ListBox.d.ts +20 -0
  52. package/dist/cjs/types/src/powell/components/ListBox/index.d.ts +1 -0
  53. package/dist/cjs/types/src/powell/components/Mention/Mention.d.ts +24 -0
  54. package/dist/cjs/types/src/powell/components/Mention/index.d.ts +1 -0
  55. package/dist/cjs/types/src/powell/components/MultiSelect/MultiSelect.d.ts +24 -0
  56. package/dist/cjs/types/src/powell/components/MultiSelect/index.d.ts +1 -0
  57. package/dist/cjs/types/src/powell/components/MultiStateCheckbox/MultiStateCheckbox.d.ts +20 -0
  58. package/dist/cjs/types/src/powell/components/MultiStateCheckbox/index.d.ts +1 -0
  59. package/dist/cjs/types/src/powell/components/RadioGroup/RadioGroup.d.ts +24 -0
  60. package/dist/cjs/types/src/powell/components/RadioGroup/index.d.ts +1 -0
  61. package/dist/cjs/types/src/powell/components/Rating/Rating.d.ts +21 -0
  62. package/dist/cjs/types/src/powell/components/Rating/index.d.ts +1 -0
  63. package/dist/cjs/types/src/powell/components/SelectButton/SelectButton.d.ts +21 -0
  64. package/dist/cjs/types/src/powell/components/SelectButton/index.d.ts +1 -0
  65. package/dist/cjs/types/src/powell/components/Slider/Slider.d.ts +21 -0
  66. package/dist/cjs/types/src/powell/components/Slider/index.d.ts +1 -0
  67. package/dist/cjs/types/src/powell/components/ToggleButton/ToggleButton.d.ts +21 -0
  68. package/dist/cjs/types/src/powell/components/ToggleButton/index.d.ts +1 -0
  69. package/dist/cjs/types/src/powell/components/TreeSelect/TreeSelect.d.ts +24 -0
  70. package/dist/cjs/types/src/powell/components/TreeSelect/index.d.ts +1 -0
  71. package/dist/cjs/types/src/powell/components/TriStateCheckbox/TriStateCheckbox.d.ts +21 -0
  72. package/dist/cjs/types/src/powell/components/TriStateCheckbox/index.d.ts +1 -0
  73. package/dist/cjs/types/src/powell/hooks/index.d.ts +3 -0
  74. package/dist/cjs/types/src/powell/hooks/useApplyConfig.d.ts +17 -0
  75. package/dist/cjs/types/src/powell/hooks/useFormContext.d.ts +2 -0
  76. package/dist/cjs/types/src/powell/hooks/usePowellConfig.d.ts +2 -0
  77. package/dist/cjs/types/src/powell/index.d.ts +29 -0
  78. package/dist/cjs/types/src/powell/models/common.d.ts +7 -0
  79. package/dist/cjs/types/src/powell/models/config.d.ts +13 -0
  80. package/dist/cjs/types/src/powell/models/forms.d.ts +28 -0
  81. package/dist/cjs/types/src/powell/models/index.d.ts +3 -0
  82. package/dist/cjs/types/src/powell/utils/globalState.d.ts +19 -0
  83. package/dist/cjs/types/src/powell/utils/index.d.ts +2 -0
  84. package/dist/cjs/types/src/powell/utils/utilsService.d.ts +8 -0
  85. package/dist/cjs/types/vite.config.d.ts +2 -0
  86. package/dist/esm/index.js +1 -0
  87. package/dist/esm/types/src/components/Button/Button.d.ts +6 -0
  88. package/dist/esm/types/src/components/Button/index.d.ts +1 -0
  89. package/dist/esm/types/src/components/index.d.ts +1 -0
  90. package/dist/esm/types/src/index.d.ts +1 -0
  91. package/dist/esm/types/src/powell/api/PowellProvider.d.ts +5 -0
  92. package/dist/esm/types/src/powell/api/configService.d.ts +2 -0
  93. package/dist/esm/types/src/powell/api/forms.d.ts +73 -0
  94. package/dist/esm/types/src/powell/api/index.d.ts +5 -0
  95. package/dist/esm/types/src/powell/api/powellDefaults.d.ts +2 -0
  96. package/dist/esm/types/src/powell/api/primereact.d.ts +968 -0
  97. package/dist/esm/types/src/powell/components/AutoComplete/AutoComplete.d.ts +24 -0
  98. package/dist/esm/types/src/powell/components/AutoComplete/index.d.ts +1 -0
  99. package/dist/esm/types/src/powell/components/Button/Button.d.ts +22 -0
  100. package/dist/esm/types/src/powell/components/Button/index.d.ts +1 -0
  101. package/dist/esm/types/src/powell/components/CascadeSelect/CascadeSelect.d.ts +24 -0
  102. package/dist/esm/types/src/powell/components/CascadeSelect/index.d.ts +1 -0
  103. package/dist/esm/types/src/powell/components/Checkbox/Checkbox.d.ts +21 -0
  104. package/dist/esm/types/src/powell/components/Checkbox/index.d.ts +1 -0
  105. package/dist/esm/types/src/powell/components/Chips/Chips.d.ts +23 -0
  106. package/dist/esm/types/src/powell/components/Chips/index.d.ts +1 -0
  107. package/dist/esm/types/src/powell/components/ColorPicker/ColorPicker.d.ts +24 -0
  108. package/dist/esm/types/src/powell/components/ColorPicker/index.d.ts +1 -0
  109. package/dist/esm/types/src/powell/components/Dropdown/Dropdown.d.ts +24 -0
  110. package/dist/esm/types/src/powell/components/Dropdown/index.d.ts +1 -0
  111. package/dist/esm/types/src/powell/components/Editor/Editor.d.ts +23 -0
  112. package/dist/esm/types/src/powell/components/Editor/index.d.ts +1 -0
  113. package/dist/esm/types/src/powell/components/FormContainer/FormContainer.d.ts +7 -0
  114. package/dist/esm/types/src/powell/components/FormContainer/FormContext.d.ts +4 -0
  115. package/dist/esm/types/src/powell/components/FormContainer/index.d.ts +2 -0
  116. package/dist/esm/types/src/powell/components/InputMask/InputMask.d.ts +24 -0
  117. package/dist/esm/types/src/powell/components/InputMask/index.d.ts +1 -0
  118. package/dist/esm/types/src/powell/components/InputNumber/InputNumber.d.ts +24 -0
  119. package/dist/esm/types/src/powell/components/InputNumber/index.d.ts +1 -0
  120. package/dist/esm/types/src/powell/components/InputOtp/InputOtp.d.ts +21 -0
  121. package/dist/esm/types/src/powell/components/InputOtp/index.d.ts +1 -0
  122. package/dist/esm/types/src/powell/components/InputPassword/InputPassword.d.ts +23 -0
  123. package/dist/esm/types/src/powell/components/InputPassword/index.d.ts +1 -0
  124. package/dist/esm/types/src/powell/components/InputSwitch/InputSwitch.d.ts +21 -0
  125. package/dist/esm/types/src/powell/components/InputSwitch/index.d.ts +1 -0
  126. package/dist/esm/types/src/powell/components/InputText/InputText.d.ts +24 -0
  127. package/dist/esm/types/src/powell/components/InputText/index.d.ts +1 -0
  128. package/dist/esm/types/src/powell/components/InputTextarea/InputTextarea.d.ts +23 -0
  129. package/dist/esm/types/src/powell/components/InputTextarea/index.d.ts +1 -0
  130. package/dist/esm/types/src/powell/components/Knob/Knob.d.ts +20 -0
  131. package/dist/esm/types/src/powell/components/Knob/index.d.ts +1 -0
  132. package/dist/esm/types/src/powell/components/ListBox/ListBox.d.ts +20 -0
  133. package/dist/esm/types/src/powell/components/ListBox/index.d.ts +1 -0
  134. package/dist/esm/types/src/powell/components/Mention/Mention.d.ts +24 -0
  135. package/dist/esm/types/src/powell/components/Mention/index.d.ts +1 -0
  136. package/dist/esm/types/src/powell/components/MultiSelect/MultiSelect.d.ts +24 -0
  137. package/dist/esm/types/src/powell/components/MultiSelect/index.d.ts +1 -0
  138. package/dist/esm/types/src/powell/components/MultiStateCheckbox/MultiStateCheckbox.d.ts +20 -0
  139. package/dist/esm/types/src/powell/components/MultiStateCheckbox/index.d.ts +1 -0
  140. package/dist/esm/types/src/powell/components/RadioGroup/RadioGroup.d.ts +24 -0
  141. package/dist/esm/types/src/powell/components/RadioGroup/index.d.ts +1 -0
  142. package/dist/esm/types/src/powell/components/Rating/Rating.d.ts +21 -0
  143. package/dist/esm/types/src/powell/components/Rating/index.d.ts +1 -0
  144. package/dist/esm/types/src/powell/components/SelectButton/SelectButton.d.ts +21 -0
  145. package/dist/esm/types/src/powell/components/SelectButton/index.d.ts +1 -0
  146. package/dist/esm/types/src/powell/components/Slider/Slider.d.ts +21 -0
  147. package/dist/esm/types/src/powell/components/Slider/index.d.ts +1 -0
  148. package/dist/esm/types/src/powell/components/ToggleButton/ToggleButton.d.ts +21 -0
  149. package/dist/esm/types/src/powell/components/ToggleButton/index.d.ts +1 -0
  150. package/dist/esm/types/src/powell/components/TreeSelect/TreeSelect.d.ts +24 -0
  151. package/dist/esm/types/src/powell/components/TreeSelect/index.d.ts +1 -0
  152. package/dist/esm/types/src/powell/components/TriStateCheckbox/TriStateCheckbox.d.ts +21 -0
  153. package/dist/esm/types/src/powell/components/TriStateCheckbox/index.d.ts +1 -0
  154. package/dist/esm/types/src/powell/hooks/index.d.ts +3 -0
  155. package/dist/esm/types/src/powell/hooks/useApplyConfig.d.ts +17 -0
  156. package/dist/esm/types/src/powell/hooks/useFormContext.d.ts +2 -0
  157. package/dist/esm/types/src/powell/hooks/usePowellConfig.d.ts +2 -0
  158. package/dist/esm/types/src/powell/index.d.ts +29 -0
  159. package/dist/esm/types/src/powell/models/common.d.ts +7 -0
  160. package/dist/esm/types/src/powell/models/config.d.ts +13 -0
  161. package/dist/esm/types/src/powell/models/forms.d.ts +28 -0
  162. package/dist/esm/types/src/powell/models/index.d.ts +3 -0
  163. package/dist/esm/types/src/powell/utils/globalState.d.ts +19 -0
  164. package/dist/esm/types/src/powell/utils/index.d.ts +2 -0
  165. package/dist/esm/types/src/powell/utils/utilsService.d.ts +8 -0
  166. package/dist/esm/types/vite.config.d.ts +2 -0
  167. package/package.json +70 -0
  168. package/rollup.config.mjs +95 -0
  169. package/src/components/Button/Button.scss +43 -0
  170. package/src/components/Button/Button.stories.tsx +13 -0
  171. package/src/components/Button/Button.tsx +19 -0
  172. package/src/components/Button/index.ts +1 -0
  173. package/src/components/index.ts +1 -0
  174. package/src/index.ts +1 -0
  175. package/src/powell/api/PowellProvider.tsx +37 -0
  176. package/src/powell/api/configService.ts +4 -0
  177. package/src/powell/api/forms.ts +145 -0
  178. package/src/powell/api/index.ts +5 -0
  179. package/src/powell/api/powellDefaults.ts +11 -0
  180. package/src/powell/api/primereact.ts +1945 -0
  181. package/src/powell/components/AutoComplete/AutoComplete.scss +126 -0
  182. package/src/powell/components/AutoComplete/AutoComplete.tsx +190 -0
  183. package/src/powell/components/AutoComplete/index.ts +1 -0
  184. package/src/powell/components/Button/Button.tsx +90 -0
  185. package/src/powell/components/Button/index.ts +1 -0
  186. package/src/powell/components/CascadeSelect/CascadeSelect.scss +126 -0
  187. package/src/powell/components/CascadeSelect/CascadeSelect.tsx +190 -0
  188. package/src/powell/components/CascadeSelect/index.ts +1 -0
  189. package/src/powell/components/Checkbox/Checkbox.scss +32 -0
  190. package/src/powell/components/Checkbox/Checkbox.tsx +147 -0
  191. package/src/powell/components/Checkbox/index.ts +1 -0
  192. package/src/powell/components/Chips/Chips.scss +126 -0
  193. package/src/powell/components/Chips/Chips.tsx +190 -0
  194. package/src/powell/components/Chips/index.ts +1 -0
  195. package/src/powell/components/ColorPicker/ColorPicker.scss +126 -0
  196. package/src/powell/components/ColorPicker/ColorPicker.tsx +186 -0
  197. package/src/powell/components/ColorPicker/index.ts +1 -0
  198. package/src/powell/components/Dropdown/Dropdown.scss +126 -0
  199. package/src/powell/components/Dropdown/Dropdown.tsx +190 -0
  200. package/src/powell/components/Dropdown/index.ts +1 -0
  201. package/src/powell/components/Editor/Editor.scss +126 -0
  202. package/src/powell/components/Editor/Editor.tsx +183 -0
  203. package/src/powell/components/Editor/index.ts +1 -0
  204. package/src/powell/components/FormContainer/FormContainer.tsx +49 -0
  205. package/src/powell/components/FormContainer/FormContext.tsx +18 -0
  206. package/src/powell/components/FormContainer/index.ts +2 -0
  207. package/src/powell/components/InputMask/InputMask.scss +126 -0
  208. package/src/powell/components/InputMask/InputMask.tsx +190 -0
  209. package/src/powell/components/InputMask/index.ts +1 -0
  210. package/src/powell/components/InputNumber/InputNumber.scss +126 -0
  211. package/src/powell/components/InputNumber/InputNumber.tsx +190 -0
  212. package/src/powell/components/InputNumber/index.ts +1 -0
  213. package/src/powell/components/InputOtp/InputOtp.scss +126 -0
  214. package/src/powell/components/InputOtp/InputOtp.tsx +154 -0
  215. package/src/powell/components/InputOtp/index.ts +1 -0
  216. package/src/powell/components/InputPassword/InputPassword.scss +126 -0
  217. package/src/powell/components/InputPassword/InputPassword.tsx +189 -0
  218. package/src/powell/components/InputPassword/index.ts +1 -0
  219. package/src/powell/components/InputSwitch/InputSwitch.scss +32 -0
  220. package/src/powell/components/InputSwitch/InputSwitch.tsx +144 -0
  221. package/src/powell/components/InputSwitch/index.ts +1 -0
  222. package/src/powell/components/InputText/InputText.scss +126 -0
  223. package/src/powell/components/InputText/InputText.tsx +190 -0
  224. package/src/powell/components/InputText/index.ts +1 -0
  225. package/src/powell/components/InputTextarea/InputTextarea.scss +126 -0
  226. package/src/powell/components/InputTextarea/InputTextarea.tsx +187 -0
  227. package/src/powell/components/InputTextarea/index.ts +1 -0
  228. package/src/powell/components/Knob/Knob.scss +32 -0
  229. package/src/powell/components/Knob/Knob.tsx +134 -0
  230. package/src/powell/components/Knob/index.ts +1 -0
  231. package/src/powell/components/ListBox/ListBox.scss +32 -0
  232. package/src/powell/components/ListBox/ListBox.tsx +135 -0
  233. package/src/powell/components/ListBox/index.ts +1 -0
  234. package/src/powell/components/Mention/Mention.scss +126 -0
  235. package/src/powell/components/Mention/Mention.tsx +186 -0
  236. package/src/powell/components/Mention/index.ts +1 -0
  237. package/src/powell/components/MultiSelect/MultiSelect.scss +126 -0
  238. package/src/powell/components/MultiSelect/MultiSelect.tsx +190 -0
  239. package/src/powell/components/MultiSelect/index.ts +1 -0
  240. package/src/powell/components/MultiStateCheckbox/MultiStateCheckbox.scss +32 -0
  241. package/src/powell/components/MultiStateCheckbox/MultiStateCheckbox.tsx +143 -0
  242. package/src/powell/components/MultiStateCheckbox/index.ts +1 -0
  243. package/src/powell/components/RadioGroup/RadioGroup.scss +32 -0
  244. package/src/powell/components/RadioGroup/RadioGroup.tsx +167 -0
  245. package/src/powell/components/RadioGroup/index.ts +1 -0
  246. package/src/powell/components/Rating/Rating.scss +32 -0
  247. package/src/powell/components/Rating/Rating.tsx +135 -0
  248. package/src/powell/components/Rating/index.ts +1 -0
  249. package/src/powell/components/SelectButton/SelectButton.scss +32 -0
  250. package/src/powell/components/SelectButton/SelectButton.tsx +144 -0
  251. package/src/powell/components/SelectButton/index.ts +1 -0
  252. package/src/powell/components/Slider/Slider.scss +32 -0
  253. package/src/powell/components/Slider/Slider.tsx +135 -0
  254. package/src/powell/components/Slider/index.ts +1 -0
  255. package/src/powell/components/ToggleButton/ToggleButton.scss +32 -0
  256. package/src/powell/components/ToggleButton/ToggleButton.tsx +144 -0
  257. package/src/powell/components/ToggleButton/index.ts +1 -0
  258. package/src/powell/components/TreeSelect/TreeSelect.scss +126 -0
  259. package/src/powell/components/TreeSelect/TreeSelect.tsx +190 -0
  260. package/src/powell/components/TreeSelect/index.ts +1 -0
  261. package/src/powell/components/TriStateCheckbox/TriStateCheckbox.scss +32 -0
  262. package/src/powell/components/TriStateCheckbox/TriStateCheckbox.tsx +144 -0
  263. package/src/powell/components/TriStateCheckbox/index.ts +1 -0
  264. package/src/powell/hooks/index.ts +3 -0
  265. package/src/powell/hooks/useApplyConfig.ts +36 -0
  266. package/src/powell/hooks/useFormContext.ts +14 -0
  267. package/src/powell/hooks/usePowellConfig.ts +64 -0
  268. package/src/powell/index.ts +29 -0
  269. package/src/powell/models/common.ts +7 -0
  270. package/src/powell/models/config.ts +85 -0
  271. package/src/powell/models/forms.ts +33 -0
  272. package/src/powell/models/index.ts +3 -0
  273. package/src/powell/styles/common.scss +9 -0
  274. package/src/powell/styles/mixins.scss +0 -0
  275. package/src/powell/themes/arya-blue.css +1 -0
  276. package/src/powell/themes/arya-green.css +1 -0
  277. package/src/powell/themes/arya-orange.css +1 -0
  278. package/src/powell/themes/arya-purple.css +1 -0
  279. package/src/powell/themes/bootstrap4-dark-blue.css +1 -0
  280. package/src/powell/themes/bootstrap4-dark-purple.css +1 -0
  281. package/src/powell/themes/bootstrap4-light-blue.css +1 -0
  282. package/src/powell/themes/bootstrap4-light-purple.css +1 -0
  283. package/src/powell/themes/fluent-light.css +1 -0
  284. package/src/powell/themes/lara-dark-amber.css +1 -0
  285. package/src/powell/themes/lara-dark-blue.css +1 -0
  286. package/src/powell/themes/lara-dark-cyan.css +1 -0
  287. package/src/powell/themes/lara-dark-green.css +1 -0
  288. package/src/powell/themes/lara-dark-indigo.css +1 -0
  289. package/src/powell/themes/lara-dark-pink.css +1 -0
  290. package/src/powell/themes/lara-dark-purple.css +1 -0
  291. package/src/powell/themes/lara-dark-teal.css +1 -0
  292. package/src/powell/themes/lara-light-amber.css +1 -0
  293. package/src/powell/themes/lara-light-blue.css +1 -0
  294. package/src/powell/themes/lara-light-cyan.css +1 -0
  295. package/src/powell/themes/lara-light-green.css +1 -0
  296. package/src/powell/themes/lara-light-indigo.css +1 -0
  297. package/src/powell/themes/lara-light-pink.css +1 -0
  298. package/src/powell/themes/lara-light-purple.css +1 -0
  299. package/src/powell/themes/lara-light-teal.css +1 -0
  300. package/src/powell/themes/luna-amber.css +1 -0
  301. package/src/powell/themes/luna-blue.css +1 -0
  302. package/src/powell/themes/luna-green.css +1 -0
  303. package/src/powell/themes/luna-pink.css +1 -0
  304. package/src/powell/themes/md-dark-deeppurple.css +1 -0
  305. package/src/powell/themes/md-dark-indigo.css +1 -0
  306. package/src/powell/themes/md-light-deeppurple.css +1 -0
  307. package/src/powell/themes/md-light-indigo.css +1 -0
  308. package/src/powell/themes/mdc-dark-deeppurple.css +1 -0
  309. package/src/powell/themes/mdc-dark-indigo.css +1 -0
  310. package/src/powell/themes/mdc-light-deeppurple.css +1 -0
  311. package/src/powell/themes/mdc-light-indigo.css +1 -0
  312. package/src/powell/themes/mira.css +1 -0
  313. package/src/powell/themes/nano.css +1 -0
  314. package/src/powell/themes/nova-accent.css +1 -0
  315. package/src/powell/themes/nova-alt.css +1 -0
  316. package/src/powell/themes/nova.css +1 -0
  317. package/src/powell/themes/rhea.css +1 -0
  318. package/src/powell/themes/saga-blue.css +1 -0
  319. package/src/powell/themes/saga-green.css +1 -0
  320. package/src/powell/themes/saga-orange.css +1 -0
  321. package/src/powell/themes/saga-purple.css +1 -0
  322. package/src/powell/themes/soho-dark.css +1 -0
  323. package/src/powell/themes/soho-light.css +1 -0
  324. package/src/powell/themes/tailwind-light.css +1 -0
  325. package/src/powell/themes/vela-blue.css +1 -0
  326. package/src/powell/themes/vela-green.css +1 -0
  327. package/src/powell/themes/vela-orange.css +1 -0
  328. package/src/powell/themes/vela-purple.css +1 -0
  329. package/src/powell/themes/viva-dark.css +1 -0
  330. package/src/powell/themes/viva-light.css +1 -0
  331. package/src/powell/utils/globalState.ts +96 -0
  332. package/src/powell/utils/index.ts +2 -0
  333. package/src/powell/utils/utilsService.tsx +55 -0
  334. package/src/stories/Button.stories.tsx +16 -0
  335. package/tsconfig.json +55 -0
  336. package/vite.config.ts +14 -0
@@ -0,0 +1,190 @@
1
+ import {ChangeEvent, ReactNode, useCallback, useRef, useState} from "react";
2
+ import {Addon, LabelPosition, Size} from "@powell/models";
3
+ import {
4
+ $classNames,
5
+ $ErrorMessage,
6
+ $Field,
7
+ $FieldProps,
8
+ $FloatLabel,
9
+ $IconField,
10
+ $IconFieldProps,
11
+ $InputIcon,
12
+ $MultiSelect,
13
+ $MultiSelectProps,
14
+ $UniqueComponentId
15
+ } from "@powell/api";
16
+ import {getAddonTemplate, isRequiredField, transformer} from "@powell/utils";
17
+ import {useApplyConfig, useFormContext} from "@powell/hooks";
18
+ import {SafeAny} from "@powell/models";
19
+ import '@components/MultiSelect/MultiSelect.scss';
20
+
21
+ interface MultiSelectProps extends $MultiSelectProps {
22
+ name?: string;
23
+ parseError?: (error: string) => ReactNode;
24
+ transform?: {
25
+ input?: (value: SafeAny) => string;
26
+ output?: (event: ChangeEvent<HTMLInputElement>) => SafeAny;
27
+ };
28
+ showRequiredStar?: boolean;
29
+ rtl?: boolean;
30
+ label?: string;
31
+ icon?: string | ReactNode;
32
+ hint?: string;
33
+ inputSize?: Size;
34
+ addon?: Addon;
35
+ iconPosition?: $IconFieldProps["iconPosition"];
36
+ labelPosition?: LabelPosition;
37
+ }
38
+
39
+ export const MultiSelect = (props: MultiSelectProps) => {
40
+ props = useApplyConfig(props);
41
+ const {
42
+ parseError,
43
+ name,
44
+ transform = {},
45
+ iconPosition = 'left',
46
+ labelPosition,
47
+ addon,
48
+ icon,
49
+ rtl,
50
+ showRequiredStar,
51
+ variant,
52
+ inputSize,
53
+ ...rest
54
+ } = props;
55
+
56
+ const inputId = useRef($UniqueComponentId());
57
+
58
+ // Check if we're in Formik context
59
+ const formContext = useFormContext();
60
+ const withinForm = !!formContext && !!name;
61
+ const isRequired = withinForm && isRequiredField(formContext, name);
62
+
63
+ // Internal state for non-Formik usage
64
+ const [internalValue, setInternalValue] = useState(rest.value || '');
65
+
66
+ const rootEl = useCallback(() => {
67
+ const commonProps = {
68
+ ...rest,
69
+ variant,
70
+ id: inputId.current,
71
+ name,
72
+ };
73
+
74
+ if (withinForm) {
75
+ // if in Formik context
76
+ return (
77
+ <$Field name={name}>
78
+ {({field, meta}: $FieldProps) => {
79
+ const {value, onChange} = transformer({
80
+ value: field.value,
81
+ onChange: (event: string) => formContext.setFieldValue(name, event),
82
+ transform: {
83
+ input: transform.input ?? (value => value),
84
+ output: transform.output ?? (event => event.target.value)
85
+ }
86
+ });
87
+
88
+ return (
89
+ <>
90
+ <$MultiSelect
91
+ {...commonProps}
92
+ value={value}
93
+ onChange={(event) => {
94
+ onChange(event);
95
+ rest.onChange?.(event);
96
+ }}
97
+ onBlur={(event) => {
98
+ field.onBlur(event);
99
+ rest.onBlur?.(event);
100
+ }}
101
+ invalid={!!meta.error}
102
+ />
103
+ <$ErrorMessage name={name}>
104
+ {
105
+ (message) => <small className="error">{parseError?.(message) ?? message}</small>
106
+ }
107
+ </$ErrorMessage>
108
+ <small className="hint">{rest.hint}</small>
109
+ </>
110
+ );
111
+ }}
112
+ </$Field>
113
+ );
114
+ } else {
115
+ // if outside Formik context
116
+ const {value, onChange} = transformer({
117
+ value: internalValue,
118
+ onChange: (event: string) => setInternalValue(event),
119
+ transform: {
120
+ input: transform.input ?? (value => value),
121
+ output: transform.output ?? (event => event.target.value)
122
+ }
123
+ });
124
+
125
+ return (
126
+ <$MultiSelect
127
+ {...commonProps}
128
+ value={value}
129
+ onChange={(event) => {
130
+ onChange(event);
131
+ rest.onChange?.(event);
132
+ }}
133
+ onBlur={rest.onBlur}
134
+ />
135
+ );
136
+ }
137
+ }, [internalValue, props]);
138
+
139
+ const labelEl = rest.label && (
140
+ <label htmlFor={inputId.current}>
141
+ {rest.label}
142
+ {isRequired && showRequiredStar ? '*' : ''}
143
+ </label>
144
+ );
145
+
146
+ const iconEl = icon && (
147
+ typeof icon === 'string'
148
+ ? <$InputIcon className={icon}></$InputIcon>
149
+ : <$InputIcon>{icon}</$InputIcon>
150
+ );
151
+
152
+ const withIcon = (
153
+ <$IconField iconPosition={iconPosition}>
154
+ {iconEl}
155
+ {rootEl()}
156
+ </$IconField>
157
+ );
158
+
159
+ return (
160
+ <div className={$classNames('dropdown-wrapper',
161
+ `variant-${variant}`,
162
+ `p-inputtext-${inputSize}`,
163
+ {
164
+ [`label-${labelPosition}`]: rest.label,
165
+ [`icon-${iconPosition}`]: iconEl,
166
+ 'is-rtl': rtl,
167
+ 'is-ltr': !rtl,
168
+ 'addon-before': addon?.before,
169
+ 'addon-after': addon?.after,
170
+ })}>
171
+ <div className="field">
172
+ {labelPosition !== 'float' && labelEl}
173
+ <div className={$classNames('field-inner', {"p-inputgroup": addon})}>
174
+ {getAddonTemplate(addon?.before)}
175
+ {
176
+ labelPosition === 'float' ? (
177
+ <$FloatLabel>
178
+ {icon ? withIcon : rootEl()}
179
+ {labelEl}
180
+ </$FloatLabel>
181
+ ) : (
182
+ icon ? withIcon : rootEl()
183
+ )
184
+ }
185
+ {getAddonTemplate(addon?.after)}
186
+ </div>
187
+ </div>
188
+ </div>
189
+ );
190
+ };
@@ -0,0 +1 @@
1
+ export * from "./MultiSelect";
@@ -0,0 +1,32 @@
1
+ .checkbox-wrapper {
2
+ .field {
3
+ display: flex;
4
+ gap: 0.25rem 1rem;
5
+
6
+ > .field-inner {
7
+ flex-grow: 1;
8
+ display: flex;
9
+ }
10
+ }
11
+
12
+ &.label-fix-side .field {
13
+ flex-direction: row;
14
+ align-items: center;
15
+ }
16
+
17
+ &.label-fix-top .field {
18
+ flex-direction: column;
19
+
20
+ label {
21
+ margin-bottom: 0.25rem;
22
+ }
23
+ }
24
+
25
+ &.is-ltr {
26
+ direction: ltr;
27
+ }
28
+
29
+ &.is-rtl {
30
+ direction: rtl;
31
+ }
32
+ }
@@ -0,0 +1,143 @@
1
+ import {ChangeEvent, ReactNode, useCallback, useRef, useState} from "react";
2
+ import {FixLabelPosition, SafeAny} from "@powell/models";
3
+ import {
4
+ $classNames,
5
+ $ErrorMessage,
6
+ $Field,
7
+ $FieldProps,
8
+ $MultiStateCheckbox,
9
+ $MultiStateCheckboxProps,
10
+ $UniqueComponentId
11
+ } from "@powell/api";
12
+ import {isRequiredField, transformer} from "@powell/utils";
13
+ import {useApplyConfig, useFormContext} from "@powell/hooks";
14
+ import '@components/MultiStateCheckbox/MultiStateCheckbox.scss';
15
+
16
+ interface MultiStateCheckboxProps extends Omit<$MultiStateCheckboxProps, 'checked'> {
17
+ checked?: boolean;
18
+ name?: string;
19
+ parseError?: (error: string) => ReactNode;
20
+ transform?: {
21
+ input?: (value: SafeAny) => string;
22
+ output?: (event: ChangeEvent<HTMLInputElement>) => SafeAny;
23
+ };
24
+ showRequiredStar?: boolean;
25
+ rtl?: boolean;
26
+ label?: string;
27
+ hint?: string;
28
+ labelPosition?: FixLabelPosition;
29
+ }
30
+
31
+ export const MultiStateCheckbox = (props: MultiStateCheckboxProps) => {
32
+ props = useApplyConfig(props, {sizable: false, isFixLabel: true});
33
+ const {
34
+ parseError,
35
+ name,
36
+ transform = {},
37
+ labelPosition,
38
+ rtl,
39
+ showRequiredStar,
40
+ ...rest
41
+ } = props;
42
+
43
+ const inputId = useRef($UniqueComponentId());
44
+
45
+ // Check if we're in Formik context
46
+ const formContext = useFormContext();
47
+ const withinForm = !!formContext && !!name;
48
+ const isRequired = withinForm && isRequiredField(formContext, name);
49
+
50
+ // Internal state for non-Formik usage
51
+ const [internalValue, setInternalValue] = useState(rest.value);
52
+
53
+ const rootEl = useCallback(() => {
54
+ const commonProps = {
55
+ ...rest,
56
+ inputId: inputId.current,
57
+ name,
58
+ };
59
+
60
+ if (withinForm) {
61
+ // if in Formik context
62
+ return (
63
+ <$Field name={name}>
64
+ {({field}: $FieldProps) => {
65
+ const {value, onChange} = transformer({
66
+ value: field.value,
67
+ onChange: (event: boolean) => formContext.setFieldValue(name, event),
68
+ transform: {
69
+ input: transform.input ?? (value => value),
70
+ output: transform.output ?? (event => event.value)
71
+ }
72
+ });
73
+
74
+ return (
75
+ <>
76
+ <$MultiStateCheckbox
77
+ {...commonProps}
78
+ value={value}
79
+ onChange={(event) => {
80
+ console.log(event)
81
+ onChange(event);
82
+ rest.onChange?.(event);
83
+ }}
84
+ />
85
+ <$ErrorMessage name={name}>
86
+ {
87
+ (message) => <small className="error">{parseError?.(message) ?? message}</small>
88
+ }
89
+ </$ErrorMessage>
90
+ <small className="hint">{rest.hint}</small>
91
+ </>
92
+ );
93
+ }}
94
+ </$Field>
95
+ );
96
+ } else {
97
+ // if outside Formik context
98
+ const {value, onChange} = transformer({
99
+ value: internalValue,
100
+ onChange: (event: boolean) => setInternalValue(event),
101
+ transform: {
102
+ input: transform.input ?? (value => value),
103
+ output: transform.output ?? (event => event.value)
104
+ }
105
+ });
106
+
107
+ return (
108
+ <$MultiStateCheckbox
109
+ {...commonProps}
110
+ value={value}
111
+ onChange={(event) => {
112
+ onChange(event);
113
+ rest.onChange?.(event);
114
+ }}
115
+ onBlur={rest.onBlur}
116
+ />
117
+ );
118
+ }
119
+ }, [internalValue, props]);
120
+
121
+ const labelEl = rest.label && (
122
+ <label htmlFor={inputId.current}>
123
+ {rest.label}
124
+ {isRequired && showRequiredStar ? '*' : ''}
125
+ </label>
126
+ );
127
+
128
+ return (
129
+ <div className={$classNames('checkbox-wrapper',
130
+ {
131
+ [`label-${labelPosition}`]: rest.label,
132
+ 'is-rtl': rtl,
133
+ 'is-ltr': !rtl,
134
+ })}>
135
+ <div className="field">
136
+ {labelEl}
137
+ <div className={$classNames('field-inner')}>
138
+ {rootEl()}
139
+ </div>
140
+ </div>
141
+ </div>
142
+ );
143
+ };
@@ -0,0 +1 @@
1
+ export * from "./MultiStateCheckbox";
@@ -0,0 +1,32 @@
1
+ .input-switch-wrapper {
2
+ .field {
3
+ display: flex;
4
+ gap: 0.25rem 1rem;
5
+
6
+ > .field-inner {
7
+ flex-grow: 1;
8
+ display: flex;
9
+ }
10
+ }
11
+
12
+ &.label-fix-side .field {
13
+ flex-direction: row;
14
+ align-items: center;
15
+ }
16
+
17
+ &.label-fix-top .field {
18
+ flex-direction: column;
19
+
20
+ label {
21
+ margin-bottom: 0.25rem;
22
+ }
23
+ }
24
+
25
+ &.is-ltr {
26
+ direction: ltr;
27
+ }
28
+
29
+ &.is-rtl {
30
+ direction: rtl;
31
+ }
32
+ }
@@ -0,0 +1,167 @@
1
+ import {ChangeEvent, ReactNode, useCallback, useRef, useState} from "react";
2
+ import {FixLabelPosition} from "@powell/models";
3
+ import {
4
+ $classNames,
5
+ $ErrorMessage,
6
+ $Field,
7
+ $FieldProps,
8
+ $RadioButton,
9
+ $RadioButtonProps,
10
+ $UniqueComponentId
11
+ } from "@powell/api";
12
+ import {isRequiredField, transformer} from "@powell/utils";
13
+ import {useApplyConfig, useFormContext} from "@powell/hooks";
14
+ import {SafeAny} from "@powell/models";
15
+ import '@components/RadioGroup/RadioGroup.scss';
16
+
17
+ interface RadioGroupProps extends Omit<$RadioButtonProps, 'checked'> {
18
+ checked?: boolean;
19
+ name: string;
20
+ parseError?: (error: string) => ReactNode;
21
+ transform?: {
22
+ input?: (value: SafeAny) => string;
23
+ output?: (event: ChangeEvent<HTMLInputElement>) => SafeAny;
24
+ };
25
+ showRequiredStar?: boolean;
26
+ rtl?: boolean;
27
+ label?: string;
28
+ hint?: string;
29
+ labelPosition?: FixLabelPosition;
30
+ options: SafeAny[];
31
+ optionLabel?: string;
32
+ optionValue?: string;
33
+ }
34
+
35
+ export const RadioGroup = (props: RadioGroupProps) => {
36
+ props = useApplyConfig(props, {sizable: false, isFixLabel: true});
37
+ const {
38
+ parseError,
39
+ name,
40
+ transform = {},
41
+ labelPosition,
42
+ rtl,
43
+ showRequiredStar,
44
+ options,
45
+ optionLabel = 'label',
46
+ optionValue = 'value',
47
+ ...rest
48
+ } = props;
49
+
50
+ // Check if we're in Formik context
51
+ const formContext = useFormContext();
52
+ const withinForm = !!formContext && !!name;
53
+ const isRequired = withinForm && isRequiredField(formContext, name);
54
+
55
+ // Internal state for non-Formik usage
56
+ const [internalValue, setInternalValue] = useState(rest.checked);
57
+
58
+ const processedOptions = useRef(options.map(option => ({
59
+ ...option,
60
+ __id: $UniqueComponentId()
61
+ })));
62
+
63
+ const rootEl = useCallback(() => {
64
+ const commonProps = {
65
+ ...rest,
66
+ name,
67
+ };
68
+
69
+ if (withinForm) {
70
+ // if in Formik context
71
+ return (
72
+ <$Field name={name}>
73
+ {({field, meta}: $FieldProps) => {
74
+ const {value, onChange} = transformer({
75
+ value: field.value,
76
+ onChange: (event: boolean) => formContext.setFieldValue(name, event),
77
+ transform: {
78
+ input: transform.input ?? (value => value),
79
+ output: transform.output ?? (event => event.value)
80
+ }
81
+ });
82
+
83
+ return (
84
+ <>
85
+ {
86
+ processedOptions.current.map(option => (
87
+ <>
88
+ <$RadioButton
89
+ {...commonProps}
90
+ inputId={option.__id}
91
+ checked={value === option[optionValue]}
92
+ value={option[optionValue]}
93
+ onChange={(event) => {
94
+ onChange(event);
95
+ rest.onChange?.(event);
96
+ }}
97
+ invalid={!!meta.error}
98
+ />
99
+ <label htmlFor={option.__id}>{option[optionLabel]}</label>
100
+ </>
101
+ ))
102
+ }
103
+ <$ErrorMessage name={name}>
104
+ {
105
+ (message) => <small className="error">{parseError?.(message) ?? message}</small>
106
+ }
107
+ </$ErrorMessage>
108
+ <small className="hint">{rest.hint}</small>
109
+ </>
110
+ );
111
+ }}
112
+ </$Field>
113
+ );
114
+ } else {
115
+ // if outside Formik context
116
+ const {value, onChange} = transformer({
117
+ value: internalValue,
118
+ onChange: (event: boolean) => setInternalValue(event),
119
+ transform: {
120
+ input: transform.input ?? (value => value),
121
+ output: transform.output ?? (event => event.value)
122
+ }
123
+ });
124
+
125
+ return (
126
+ processedOptions.current.map(option => (
127
+ <>
128
+ <$RadioButton
129
+ {...commonProps}
130
+ inputId={option.__id}
131
+ checked={value === option[optionValue]}
132
+ value={option[optionValue]}
133
+ onChange={(event) => {
134
+ onChange(event);
135
+ rest.onChange?.(event);
136
+ }}
137
+ />
138
+ <label htmlFor={option.__id}>{option[optionLabel]}</label>
139
+ </>
140
+ ))
141
+ );
142
+ }
143
+ }, [internalValue, props]);
144
+
145
+ const labelEl = rest.label && (
146
+ <label>
147
+ {rest.label}
148
+ {isRequired && showRequiredStar ? '*' : ''}
149
+ </label>
150
+ );
151
+
152
+ return (
153
+ <div className={$classNames('checkbox-wrapper',
154
+ {
155
+ [`label-${labelPosition}`]: rest.label,
156
+ 'is-rtl': rtl,
157
+ 'is-ltr': !rtl,
158
+ })}>
159
+ <div className="field">
160
+ {labelEl}
161
+ <div className={$classNames('field-inner')}>
162
+ {rootEl()}
163
+ </div>
164
+ </div>
165
+ </div>
166
+ );
167
+ };
@@ -0,0 +1 @@
1
+ export * from "./RadioGroup";
@@ -0,0 +1,32 @@
1
+ .knob-wrapper {
2
+ .field {
3
+ display: flex;
4
+ gap: 0.25rem 1rem;
5
+
6
+ > .field-inner {
7
+ flex-grow: 1;
8
+ display: flex;
9
+ }
10
+ }
11
+
12
+ &.label-fix-side .field {
13
+ flex-direction: row;
14
+ align-items: center;
15
+ }
16
+
17
+ &.label-fix-top .field {
18
+ flex-direction: column;
19
+
20
+ label {
21
+ margin-bottom: 0.25rem;
22
+ }
23
+ }
24
+
25
+ &.is-ltr {
26
+ direction: ltr;
27
+ }
28
+
29
+ &.is-rtl {
30
+ direction: rtl;
31
+ }
32
+ }