@sigtes/ui 0.2.9 → 0.2.10

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 (48) hide show
  1. package/dist/components/checkbox/Checkbox.d.ts +1 -1
  2. package/dist/components/dialog/Dialog.d.ts +1 -1
  3. package/dist/components/dropdown-menu/Dropdown-Menu.d.ts +1 -1
  4. package/dist/components/form/Form.d.ts +1 -1
  5. package/dist/components/label/Label.d.ts +1 -1
  6. package/dist/components/select/Select.d.ts +1 -1
  7. package/dist/components/separator/Separator.d.ts +1 -1
  8. package/dist/components/table/index.d.ts +2 -2
  9. package/dist/components/tabs/Tabs.d.ts +1 -1
  10. package/dist/components.cjs.js +4 -4397
  11. package/dist/components.es.js +2685 -112392
  12. package/dist/pages.cjs.js +1 -1
  13. package/dist/pages.es.js +7 -8
  14. package/dist/providers.es-DW20XFKL.cjs +43 -0
  15. package/dist/providers.es-DkWBRd2l.js +2362 -0
  16. package/dist/utils/index.d.ts +1 -0
  17. package/package.json +6 -17
  18. package/dist/Button-BOLYI9iw.js +0 -69
  19. package/dist/Button-ObM8zTKC.cjs +0 -1
  20. package/dist/UserProvider-Sov75KqP.cjs +0 -22
  21. package/dist/UserProvider-ultyW1kJ.js +0 -395
  22. package/dist/hooks/index.d.ts +0 -6
  23. package/dist/hooks/useAuthorization/index.d.ts +0 -1
  24. package/dist/hooks/useAuthorization/useAuthorization.d.ts +0 -2
  25. package/dist/hooks/useErrors/index.d.ts +0 -1
  26. package/dist/hooks/useErrors/useErrors.d.ts +0 -13
  27. package/dist/hooks/useFormState/index.d.ts +0 -1
  28. package/dist/hooks/useFormState/useFormState.d.ts +0 -18
  29. package/dist/hooks/useQuery/index.d.ts +0 -1
  30. package/dist/hooks/useQuery/useQuery.d.ts +0 -9
  31. package/dist/hooks.cjs.js +0 -1
  32. package/dist/hooks.es.js +0 -73
  33. package/dist/locale-provider-TirFJhph.cjs +0 -1
  34. package/dist/locale-provider-XVCCI6ZB.js +0 -831
  35. package/dist/models/date/date.d.ts +0 -26
  36. package/dist/models/date/index.d.ts +0 -1
  37. package/dist/models/index.d.ts +0 -1
  38. package/dist/models.cjs.js +0 -1
  39. package/dist/models.es.js +0 -170
  40. package/dist/providers/index.d.ts +0 -3
  41. package/dist/providers/locale-provider/index.d.ts +0 -1
  42. package/dist/providers/locale-provider/locale-provider.d.ts +0 -11
  43. package/dist/providers/theme-provider/ThemeProvider.d.ts +0 -3
  44. package/dist/providers/theme-provider/index.d.ts +0 -2
  45. package/dist/providers/user-provider/UserProvider.d.ts +0 -25
  46. package/dist/providers/user-provider/index.d.ts +0 -1
  47. package/dist/providers.cjs.js +0 -1
  48. package/dist/providers.es.js +0 -21
package/dist/hooks.es.js DELETED
@@ -1,73 +0,0 @@
1
- import { useState as c, useEffect as l } from "react";
2
- import { toast as i } from "sonner";
3
- import { useForm as U } from "react-hook-form";
4
- import { u as d } from "./UserProvider-ultyW1kJ.js";
5
- import "@tanstack/react-query";
6
- function a(s) {
7
- if (typeof s != "object" || s === null)
8
- return !1;
9
- const e = s;
10
- return "name" in e && typeof e.name == "string" && "message" in e && typeof e.message == "string" && "action" in e && typeof e.action == "string" && "statusCode" in e && typeof e.statusCode == "number";
11
- }
12
- function g(s, e) {
13
- if (a(e)) {
14
- i.error(e.message);
15
- return;
16
- }
17
- if (e) {
18
- i.success(s.message);
19
- return;
20
- }
21
- i.error(s.errorMessage);
22
- }
23
- function E(s) {
24
- a(s) ? i.error("Falha na solicitação.", {
25
- description: `${s.name} | ${s.message}`
26
- }) : i.error("Erro desconhecido.");
27
- }
28
- const A = {
29
- handleApiReponse: g,
30
- handleApiError: E
31
- };
32
- function D(s) {
33
- const [e, t] = c(!1), [n, o] = c(!1), [f, u] = c(s);
34
- function r(m) {
35
- const p = {
36
- create: () => {
37
- t(!0), o(!1);
38
- },
39
- edit: () => {
40
- t(!0), o(!0);
41
- }
42
- }[m];
43
- p();
44
- }
45
- return {
46
- open: r,
47
- setData: u,
48
- currentState: {
49
- data: f,
50
- isEditMode: n,
51
- isVisible: e,
52
- setIsVisible: t
53
- },
54
- controls: {
55
- onCreate: () => r("create"),
56
- onUpdate: () => r("edit"),
57
- setData: u
58
- }
59
- };
60
- }
61
- const h = "/forbidden";
62
- function M(s, e, t = "") {
63
- const { user: n, isLoading: o } = d();
64
- l(() => {
65
- e && n.id === "" && !o && e.push("/login"), e && n.id !== "" && !o && (n.features.includes(s) ? e.push(t) : e.push(h));
66
- }, [e, n, o, s, t]);
67
- }
68
- export {
69
- M as useAuthorization,
70
- A as useErrors,
71
- U as useForm,
72
- D as useFormState
73
- };
@@ -1 +0,0 @@
1
- "use client";"use strict";const P=require("./UserProvider-Sov75KqP.cjs"),h=require("react"),p={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},M=(e,a,t)=>{let n;const o=p[e];return typeof o=="string"?n=o:a===1?n=o.one:n=o.other.replace("{{count}}",a.toString()),t?.addSuffix?t.comparison&&t.comparison>0?"in "+n:n+" ago":n};function u(e){return(a={})=>{const t=a.width?String(a.width):e.defaultWidth;return e.formats[t]||e.formats[e.defaultWidth]}}const W={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},k={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},j={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},x={date:u({formats:W,defaultWidth:"full"}),time:u({formats:k,defaultWidth:"full"}),dateTime:u({formats:j,defaultWidth:"full"})},S={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},D=(e,a,t,n)=>S[e];function i(e){return(a,t)=>{const n=t?.context?String(t.context):"standalone";let o;if(n==="formatting"&&e.formattingValues){const r=e.defaultFormattingWidth||e.defaultWidth,d=t?.width?String(t.width):r;o=e.formattingValues[d]||e.formattingValues[r]}else{const r=e.defaultWidth,d=t?.width?String(t.width):e.defaultWidth;o=e.values[d]||e.values[r]}const m=e.argumentCallback?e.argumentCallback(a):a;return o[m]}}const C={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},$={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},q={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},T={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},F={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},z={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},A=(e,a)=>{const t=Number(e),n=t%100;if(n>20||n<10)switch(n%10){case 1:return t+"st";case 2:return t+"nd";case 3:return t+"rd"}return t+"th"},V={ordinalNumber:A,era:i({values:C,defaultWidth:"wide"}),quarter:i({values:$,defaultWidth:"wide",argumentCallback:e=>e-1}),month:i({values:q,defaultWidth:"wide"}),day:i({values:T,defaultWidth:"wide"}),dayPeriod:i({values:F,defaultWidth:"wide",formattingValues:z,defaultFormattingWidth:"wide"})};function s(e){return(a,t={})=>{const n=t.width,o=n&&e.matchPatterns[n]||e.matchPatterns[e.defaultMatchWidth],m=a.match(o);if(!m)return null;const r=m[0],d=n&&e.parsePatterns[n]||e.parsePatterns[e.defaultParseWidth],f=Array.isArray(d)?X(d,l=>l.test(r)):L(d,l=>l.test(r));let c;c=e.valueCallback?e.valueCallback(f):f,c=t.valueCallback?t.valueCallback(c):c;const w=a.slice(r.length);return{value:c,rest:w}}}function L(e,a){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&a(e[t]))return t}function X(e,a){for(let t=0;t<e.length;t++)if(a(e[t]))return t}function g(e){return(a,t={})=>{const n=a.match(e.matchPattern);if(!n)return null;const o=n[0],m=a.match(e.parsePattern);if(!m)return null;let r=e.valueCallback?e.valueCallback(m[0]):m[0];r=t.valueCallback?t.valueCallback(r):r;const d=a.slice(o.length);return{value:r,rest:d}}}const E=/^(\d+)(th|st|nd|rd)?/i,N=/\d+/i,H={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},R={any:[/^b/i,/^(a|c)/i]},O={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Q={any:[/1/i,/2/i,/3/i,/4/i]},J={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Y={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},_={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},B={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},U={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},I={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},K={ordinalNumber:g({matchPattern:E,parsePattern:N,valueCallback:e=>parseInt(e,10)}),era:s({matchPatterns:H,defaultMatchWidth:"wide",parsePatterns:R,defaultParseWidth:"any"}),quarter:s({matchPatterns:O,defaultMatchWidth:"wide",parsePatterns:Q,defaultParseWidth:"any",valueCallback:e=>e+1}),month:s({matchPatterns:J,defaultMatchWidth:"wide",parsePatterns:Y,defaultParseWidth:"any"}),day:s({matchPatterns:_,defaultMatchWidth:"wide",parsePatterns:B,defaultParseWidth:"any"}),dayPeriod:s({matchPatterns:U,defaultMatchWidth:"any",parsePatterns:I,defaultParseWidth:"any"})},y={code:"en-US",formatDistance:M,formatLong:x,formatRelative:D,localize:V,match:K,options:{weekStartsOn:0,firstWeekContainsDate:1}},G={lessThanXSeconds:{one:"menos de um segundo",other:"menos de {{count}} segundos"},xSeconds:{one:"1 segundo",other:"{{count}} segundos"},halfAMinute:"meio minuto",lessThanXMinutes:{one:"menos de um minuto",other:"menos de {{count}} minutos"},xMinutes:{one:"1 minuto",other:"{{count}} minutos"},aboutXHours:{one:"cerca de 1 hora",other:"cerca de {{count}} horas"},xHours:{one:"1 hora",other:"{{count}} horas"},xDays:{one:"1 dia",other:"{{count}} dias"},aboutXWeeks:{one:"cerca de 1 semana",other:"cerca de {{count}} semanas"},xWeeks:{one:"1 semana",other:"{{count}} semanas"},aboutXMonths:{one:"cerca de 1 mês",other:"cerca de {{count}} meses"},xMonths:{one:"1 mês",other:"{{count}} meses"},aboutXYears:{one:"cerca de 1 ano",other:"cerca de {{count}} anos"},xYears:{one:"1 ano",other:"{{count}} anos"},overXYears:{one:"mais de 1 ano",other:"mais de {{count}} anos"},almostXYears:{one:"quase 1 ano",other:"quase {{count}} anos"}},Z=(e,a,t)=>{let n;const o=G[e];return typeof o=="string"?n=o:a===1?n=o.one:n=o.other.replace("{{count}}",String(a)),t?.addSuffix?t.comparison&&t.comparison>0?"em "+n:"há "+n:n},ee={full:"EEEE, d 'de' MMMM 'de' y",long:"d 'de' MMMM 'de' y",medium:"d MMM y",short:"dd/MM/yyyy"},te={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},ae={full:"{{date}} 'às' {{time}}",long:"{{date}} 'às' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},ne={date:u({formats:ee,defaultWidth:"full"}),time:u({formats:te,defaultWidth:"full"}),dateTime:u({formats:ae,defaultWidth:"full"})},oe={lastWeek:e=>{const a=e.getDay();return"'"+(a===0||a===6?"último":"última")+"' eeee 'às' p"},yesterday:"'ontem às' p",today:"'hoje às' p",tomorrow:"'amanhã às' p",nextWeek:"eeee 'às' p",other:"P"},re=(e,a,t,n)=>{const o=oe[e];return typeof o=="function"?o(a):o},ie={narrow:["AC","DC"],abbreviated:["AC","DC"],wide:["antes de cristo","depois de cristo"]},se={narrow:["1","2","3","4"],abbreviated:["T1","T2","T3","T4"],wide:["1º trimestre","2º trimestre","3º trimestre","4º trimestre"]},de={narrow:["j","f","m","a","m","j","j","a","s","o","n","d"],abbreviated:["jan","fev","mar","abr","mai","jun","jul","ago","set","out","nov","dez"],wide:["janeiro","fevereiro","março","abril","maio","junho","julho","agosto","setembro","outubro","novembro","dezembro"]},me={narrow:["D","S","T","Q","Q","S","S"],short:["dom","seg","ter","qua","qui","sex","sab"],abbreviated:["domingo","segunda","terça","quarta","quinta","sexta","sábado"],wide:["domingo","segunda-feira","terça-feira","quarta-feira","quinta-feira","sexta-feira","sábado"]},ue={narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"manhã",afternoon:"tarde",evening:"tarde",night:"noite"},abbreviated:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"manhã",afternoon:"tarde",evening:"tarde",night:"noite"},wide:{am:"a.m.",pm:"p.m.",midnight:"meia-noite",noon:"meio-dia",morning:"manhã",afternoon:"tarde",evening:"tarde",night:"noite"}},ce={narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"da manhã",afternoon:"da tarde",evening:"da tarde",night:"da noite"},abbreviated:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"da manhã",afternoon:"da tarde",evening:"da tarde",night:"da noite"},wide:{am:"a.m.",pm:"p.m.",midnight:"meia-noite",noon:"meio-dia",morning:"da manhã",afternoon:"da tarde",evening:"da tarde",night:"da noite"}},he=(e,a)=>{const t=Number(e);return a?.unit==="week"?t+"ª":t+"º"},le={ordinalNumber:he,era:i({values:ie,defaultWidth:"wide"}),quarter:i({values:se,defaultWidth:"wide",argumentCallback:e=>e-1}),month:i({values:de,defaultWidth:"wide"}),day:i({values:me,defaultWidth:"wide"}),dayPeriod:i({values:ue,defaultWidth:"wide",formattingValues:ce,defaultFormattingWidth:"wide"})},fe=/^(\d+)[ºªo]?/i,be=/\d+/i,ge={narrow:/^(ac|dc|a|d)/i,abbreviated:/^(a\.?\s?c\.?|d\.?\s?c\.?)/i,wide:/^(antes de cristo|depois de cristo)/i},ye={any:[/^ac/i,/^dc/i],wide:[/^antes de cristo/i,/^depois de cristo/i]},ve={narrow:/^[1234]/i,abbreviated:/^T[1234]/i,wide:/^[1234](º)? trimestre/i},we={any:[/1/i,/2/i,/3/i,/4/i]},Pe={narrow:/^[jfmajsond]/i,abbreviated:/^(jan|fev|mar|abr|mai|jun|jul|ago|set|out|nov|dez)/i,wide:/^(janeiro|fevereiro|março|abril|maio|junho|julho|agosto|setembro|outubro|novembro|dezembro)/i},pe={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^fev/i,/^mar/i,/^abr/i,/^mai/i,/^jun/i,/^jul/i,/^ago/i,/^set/i,/^out/i,/^nov/i,/^dez/i]},Me={narrow:/^(dom|[23456]ª?|s[aá]b)/i,short:/^(dom|[23456]ª?|s[aá]b)/i,abbreviated:/^(dom|seg|ter|qua|qui|sex|s[aá]b)/i,wide:/^(domingo|(segunda|ter[cç]a|quarta|quinta|sexta)([- ]feira)?|s[aá]bado)/i},We={short:[/^d/i,/^2/i,/^3/i,/^4/i,/^5/i,/^6/i,/^s[aá]/i],narrow:[/^d/i,/^2/i,/^3/i,/^4/i,/^5/i,/^6/i,/^s[aá]/i],any:[/^d/i,/^seg/i,/^t/i,/^qua/i,/^qui/i,/^sex/i,/^s[aá]b/i]},ke={narrow:/^(a|p|mn|md|(da) (manhã|tarde|noite))/i,any:/^([ap]\.?\s?m\.?|meia[-\s]noite|meio[-\s]dia|(da) (manhã|tarde|noite))/i},je={any:{am:/^a/i,pm:/^p/i,midnight:/^mn|^meia[-\s]noite/i,noon:/^md|^meio[-\s]dia/i,morning:/manhã/i,afternoon:/tarde/i,evening:/tarde/i,night:/noite/i}},xe={ordinalNumber:g({matchPattern:fe,parsePattern:be,valueCallback:e=>parseInt(e,10)}),era:s({matchPatterns:ge,defaultMatchWidth:"wide",parsePatterns:ye,defaultParseWidth:"any"}),quarter:s({matchPatterns:ve,defaultMatchWidth:"wide",parsePatterns:we,defaultParseWidth:"any",valueCallback:e=>e+1}),month:s({matchPatterns:Pe,defaultMatchWidth:"wide",parsePatterns:pe,defaultParseWidth:"any"}),day:s({matchPatterns:Me,defaultMatchWidth:"wide",parsePatterns:We,defaultParseWidth:"any"}),dayPeriod:s({matchPatterns:ke,defaultMatchWidth:"any",parsePatterns:je,defaultParseWidth:"any"})},Se={code:"pt-BR",formatDistance:Z,formatLong:ne,formatRelative:re,localize:le,match:xe,options:{weekStartsOn:0,firstWeekContainsDate:1}},b={ptBR:Se,enUS:y},v=h.createContext({locale:void 0});function De(){return h.useContext(v)}function Ce({locale:e,children:a}){const[t,n]=h.useState(b[e]);h.useEffect(()=>{n(b[e])},[e]);const o={locale:t};return P.jsxRuntimeExports.jsx(v.Provider,{value:o,children:a})}exports.LocaleProvider=Ce;exports.enUS=y;exports.useLocale=De;