@synertech/ui 0.52.0 → 0.53.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/skills/use-synertech-ui/SKILL.md +121 -6
- package/dist/components/checkbox/Checkbox.cjs +1 -1
- package/dist/components/checkbox/Checkbox.js +1 -1
- package/dist/components/checkbox/CheckboxGroup.cjs +1 -1
- package/dist/components/checkbox/CheckboxGroup.js +1 -1
- package/dist/components/date-picker/DatePicker.cjs +1 -0
- package/dist/components/date-picker/DatePicker.js +1 -0
- package/dist/components/date-picker/DateRangePicker.cjs +1 -0
- package/dist/components/date-picker/DateRangePicker.js +1 -0
- package/dist/components/date-picker/date-field.cjs +1 -0
- package/dist/components/date-picker/date-field.js +1 -0
- package/dist/components/date-picker/date-input.cjs +1 -0
- package/dist/components/date-picker/date-input.js +1 -0
- package/dist/components/date-picker/index.cjs +1 -0
- package/dist/components/date-picker/index.js +1 -0
- package/dist/components/file-selector/FileSelector.cjs +1 -1
- package/dist/components/file-selector/FileSelector.js +1 -1
- package/dist/components/form/form-field/FormField.cjs +1 -0
- package/dist/components/form/form-field/FormField.js +1 -0
- package/dist/components/form/form-field/index.cjs +1 -0
- package/dist/components/form/form-field/index.js +1 -0
- package/dist/components/form/index.cjs +1 -1
- package/dist/components/form/index.js +1 -1
- package/dist/components/form/input/Input.cjs +1 -1
- package/dist/components/form/input/Input.js +1 -1
- package/dist/components/form/mention-input/MentionInput.cjs +5 -5
- package/dist/components/form/mention-input/MentionInput.js +5 -5
- package/dist/components/form/number-input/NumberInput.cjs +1 -1
- package/dist/components/form/number-input/NumberInput.js +1 -1
- package/dist/components/form/shared/InputWrapper.cjs +1 -1
- package/dist/components/form/shared/InputWrapper.js +1 -1
- package/dist/components/form/shared/field-error.cjs +1 -0
- package/dist/components/form/shared/field-error.js +1 -0
- package/dist/components/form/shared/inputStyles.cjs +1 -1
- package/dist/components/form/shared/inputStyles.js +1 -1
- package/dist/components/header/Header.cjs +1 -1
- package/dist/components/header/Header.js +1 -1
- package/dist/components/help-button/HelpButton.cjs +4 -12
- package/dist/components/help-button/HelpButton.js +4 -12
- package/dist/components/help-button/MarkdownEditor.cjs +1 -1
- package/dist/components/help-button/MarkdownEditor.js +1 -1
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/popover/Popover.cjs +1 -0
- package/dist/components/popover/Popover.js +1 -0
- package/dist/components/popover/PopoverClose.cjs +1 -0
- package/dist/components/popover/PopoverClose.js +1 -0
- package/dist/components/popover/PopoverContent.cjs +1 -0
- package/dist/components/popover/PopoverContent.js +1 -0
- package/dist/components/popover/PopoverTrigger.cjs +1 -0
- package/dist/components/popover/PopoverTrigger.js +1 -0
- package/dist/components/popover/index.cjs +1 -0
- package/dist/components/popover/index.js +1 -0
- package/dist/components/radio-button/RadioButton.cjs +1 -1
- package/dist/components/radio-button/RadioButton.js +1 -1
- package/dist/components/schema-editor/tables/SchemaTableRenderer.cjs +1 -1
- package/dist/components/schema-editor/tables/SchemaTableRenderer.js +1 -1
- package/dist/components/select/Select.cjs +1 -1
- package/dist/components/select/Select.js +1 -1
- package/dist/components/slider/Slider.cjs +1 -1
- package/dist/components/slider/Slider.js +1 -1
- package/dist/components/tooltip/Tooltip.cjs +1 -1
- package/dist/components/tooltip/Tooltip.js +1 -1
- package/dist/index.d.cts +2767 -2341
- package/dist/index.d.ts +2767 -2341
- package/dist/lib/ui-labels.cjs +1 -1
- package/dist/lib/ui-labels.js +1 -1
- package/dist/styles-no-preflight.css +162 -13
- package/dist/styles.css +162 -13
- package/package.json +1 -1
|
@@ -285,10 +285,13 @@ import { cn } from "@synertech/ui";
|
|
|
285
285
|
| Composant | Description | Server-compatible |
|
|
286
286
|
|-----------|-------------|:-:|
|
|
287
287
|
| `Input` | Champ texte/textarea avec label | Non |
|
|
288
|
+
| `FormField` | Libellé, aide et erreur d'un champ sur mesure (le contrôle est le vôtre) | Oui |
|
|
288
289
|
| `Select` | Combobox searchable avec portal | Non |
|
|
289
290
|
| `Checkbox` | Case à cocher | Non |
|
|
290
291
|
| `RadioButton` | Bouton radio | Non |
|
|
291
292
|
| `Slider` | Curseur (range) accessible avec marques et tooltip | Non |
|
|
293
|
+
| `DatePicker` | Champ de date : saisie au clavier ou calendrier en popover | Non |
|
|
294
|
+
| `DateRangePicker` | Période de deux dates, avec préréglages facultatifs | Non |
|
|
292
295
|
| `ImageUploader` | Upload d'image (bouton et URL, sans glisser-déposer : c'est `FileSelector`) | Non |
|
|
293
296
|
| `FileSelector` | Sélection de fichiers/dossiers (drag & drop, validation) | Non |
|
|
294
297
|
|
|
@@ -592,8 +595,8 @@ import { Input } from "@synertech/ui";
|
|
|
592
595
|
type="email"
|
|
593
596
|
placeholder="you@example.com"
|
|
594
597
|
helperText="Votre adresse email professionnelle"
|
|
595
|
-
error=
|
|
596
|
-
hideLabel={false}
|
|
598
|
+
error="Adresse invalide" // boolean | string — voir « Erreurs des champs »
|
|
599
|
+
hideLabel={false} // true : libellé gardé pour les lecteurs d'écran
|
|
597
600
|
inline={false}
|
|
598
601
|
multiline={false} // true pour textarea
|
|
599
602
|
rows={3} // Nombre de lignes si multiline
|
|
@@ -601,6 +604,33 @@ import { Input } from "@synertech/ui";
|
|
|
601
604
|
/>
|
|
602
605
|
```
|
|
603
606
|
|
|
607
|
+
**Erreurs des champs** — `error` se lit de la même façon sur tous les champs (`Input`, `NumberInput`, `MentionInput`, `Select`, `FileSelector`, `Checkbox`, `CheckboxGroup`, `RadioButton`, `Slider`, `FormField`) :
|
|
608
|
+
- un texte marque le champ invalide et devient le message, écrit sous le champ **à la place** de `helperText` ; `true` marque le champ sans message et passe l'aide en rouge ; `false`, `undefined` et `""` ne sont pas une erreur
|
|
609
|
+
- le champ reçoit `aria-invalid` et est décrit par le message (`aria-describedby`, ajouté au vôtre s'il y en a un). Le message n'est pas une alerte : il est lu quand le champ prend le focus — envoyez-y le focus après un envoi refusé (react-hook-form le fait seul)
|
|
610
|
+
- Avec react-hook-form : `error={errors.email?.message ?? Boolean(errors.email)}` — le message de la règle, ou `true` pour une règle qui n'en a pas
|
|
611
|
+
|
|
612
|
+
### FormField (champ sur mesure)
|
|
613
|
+
|
|
614
|
+
```tsx
|
|
615
|
+
import { FormField } from "@synertech/ui";
|
|
616
|
+
|
|
617
|
+
// Le cadre d'Input autour de VOTRE contrôle : libellé, description, aide, erreur.
|
|
618
|
+
<FormField label="Couleur" helperText="Hexadécimal" error={errors.color?.message} required>
|
|
619
|
+
{(control) => <ColorPicker {...control} value={color} onChange={setColor} />}
|
|
620
|
+
</FormField>
|
|
621
|
+
|
|
622
|
+
// Un contrôle qui n'est pas un élément natif se nomme par l'id du libellé
|
|
623
|
+
<FormField label="Étiquette" error={error}>
|
|
624
|
+
{(control, field) => (
|
|
625
|
+
<div {...control} role="radiogroup" aria-labelledby={field.labelId}>…</div>
|
|
626
|
+
)}
|
|
627
|
+
</FormField>
|
|
628
|
+
```
|
|
629
|
+
|
|
630
|
+
**Notes :**
|
|
631
|
+
- `control` = `{ id, aria-describedby?, aria-invalid?, aria-required? }` : à étaler sur le contrôle. Un `<input>` natif prend aussi `required` si le navigateur doit le vérifier
|
|
632
|
+
- Server-compatible : se rend dans un Server Component, qui peut lui passer sa fonction
|
|
633
|
+
|
|
604
634
|
### Select / Combobox
|
|
605
635
|
|
|
606
636
|
```tsx
|
|
@@ -729,6 +759,45 @@ const marks: SliderMark[] = [
|
|
|
729
759
|
|
|
730
760
|
> Construit sur un `<input type="range">` natif (clavier + ARIA), avec rail/remplissage/curseur stylés. Le curseur visible et le remplissage sont décalés de la largeur du curseur pour rester alignés et ne jamais déborder du rail.
|
|
731
761
|
|
|
762
|
+
### DatePicker / DateRangePicker
|
|
763
|
+
|
|
764
|
+
```tsx
|
|
765
|
+
import { DatePicker, DateRangePicker } from "@synertech/ui";
|
|
766
|
+
import type { CalendarDateRange } from "@synertech/ui";
|
|
767
|
+
|
|
768
|
+
<DatePicker
|
|
769
|
+
label="Date d'échéance"
|
|
770
|
+
value={date} // Date | null (minuit heure locale)
|
|
771
|
+
onChange={setDate} // (date: Date | null) => void
|
|
772
|
+
minDate={today}
|
|
773
|
+
maxDate={inTwoMonths}
|
|
774
|
+
disabledDates={(d) => d.getDay() === 0} // ou Date[]
|
|
775
|
+
name="due" // envoie AAAA-MM-JJ, quelle que soit la langue
|
|
776
|
+
error={errors.due?.message ?? Boolean(errors.due)}
|
|
777
|
+
required
|
|
778
|
+
captionLayout="dropdown" // menus mois/année (date de naissance)
|
|
779
|
+
fromYear={1920}
|
|
780
|
+
toYear={2026}
|
|
781
|
+
today={today} // le « aujourd'hui » du calendrier : passez-le en rendu serveur
|
|
782
|
+
/>
|
|
783
|
+
|
|
784
|
+
<DateRangePicker
|
|
785
|
+
label="Période"
|
|
786
|
+
value={range} // CalendarDateRange : { from: Date | null; to: Date | null }
|
|
787
|
+
onChange={setRange}
|
|
788
|
+
presets={["7d", "30d", "mtd", "qtd", "ytd"]} // ou { label, from, to }
|
|
789
|
+
numberOfMonths={2}
|
|
790
|
+
startName="from"
|
|
791
|
+
endName="to"
|
|
792
|
+
/>
|
|
793
|
+
```
|
|
794
|
+
|
|
795
|
+
**Notes :**
|
|
796
|
+
- La saisie suit l'ordre de la locale (`jj/mm/aaaa` en `fr-FR`, `mm/jj/aaaa` en `en-US`, `AAAA-MM-JJ` partout) ; le texte indicatif aussi. Le calendrier s'ouvre par le bouton du champ ou Alt + ↓, le focus sur le jour choisi
|
|
797
|
+
- Le texte est lu en quittant le champ ou sur Entrée. Un texte qui n'est pas une date acceptée (format, bornes, jour exclu) reste affiché, `onChange` reçoit `null`, et le champ affiche son propre message, avant celui de `error`
|
|
798
|
+
- Les préréglages sont ceux de `ChartPeriodPicker` (mêmes clés, mêmes libellés), tenus dans `minDate` / `maxDate`. Pour un tableau de bord, gardez `ChartPeriodPicker` dans la `ChartFilterBar`
|
|
799
|
+
- `react-hook-form` : avec `Controller`, passez `field.ref` en `ref` (le focus va au champ texte après un envoi refusé) et `field.onBlur` en `onBlur`
|
|
800
|
+
|
|
732
801
|
### ImageUploader
|
|
733
802
|
|
|
734
803
|
```tsx
|
|
@@ -1470,6 +1539,51 @@ Sans `title` ni `aria-label`, la modale affiche un titre de remplacement et un
|
|
|
1470
1539
|
avertissement le signale une fois dans la console. `title=""` (ou pas de
|
|
1471
1540
|
`title`) avec un `aria-label` donne un dialogue sans titre visible.
|
|
1472
1541
|
|
|
1542
|
+
### Popover
|
|
1543
|
+
|
|
1544
|
+
Un panneau interactif ancré à son déclencheur : un petit formulaire à côté d'un
|
|
1545
|
+
bouton, des filtres, des détails sur lesquels on agit. Contrairement au
|
|
1546
|
+
`Tooltip`, son contenu prend le focus ; contrairement à la `Modal`, la page
|
|
1547
|
+
derrière reste active.
|
|
1548
|
+
|
|
1549
|
+
```tsx
|
|
1550
|
+
import { Button, Popover, PopoverClose, PopoverContent, PopoverTrigger } from "@synertech/ui";
|
|
1551
|
+
|
|
1552
|
+
<Popover>
|
|
1553
|
+
<PopoverTrigger asChild>
|
|
1554
|
+
<Button label="Filtres" />
|
|
1555
|
+
</PopoverTrigger>
|
|
1556
|
+
<PopoverContent side="bottom" align="start" className="w-72">
|
|
1557
|
+
{/* champs du filtre */}
|
|
1558
|
+
<PopoverClose asChild>
|
|
1559
|
+
<Button label="Appliquer" />
|
|
1560
|
+
</PopoverClose>
|
|
1561
|
+
</PopoverContent>
|
|
1562
|
+
</Popover>
|
|
1563
|
+
```
|
|
1564
|
+
|
|
1565
|
+
- **État** : non contrôlé (`defaultOpen`) ou contrôlé (`open` + `onOpenChange`).
|
|
1566
|
+
`closeOnEscape` et `closeOnClickOutside` valent `true` par défaut.
|
|
1567
|
+
- **Placement** : `side` (`bottom` par défaut), `align` (`center` par défaut),
|
|
1568
|
+
`sideOffset` (8 px). Le panneau passe de l'autre côté quand celui-ci a plus
|
|
1569
|
+
de place, puis reste dans la fenêtre ; plus haut qu'elle, il défile.
|
|
1570
|
+
- **Focus** : à l'ouverture, il va au premier champ ou bouton du panneau (au
|
|
1571
|
+
panneau lui-même s'il n'en a pas), ou à l'élément que renvoie
|
|
1572
|
+
`initialFocus={(panel) => …}` (le jour choisi d'un calendrier). Échap et `PopoverClose` le rendent au
|
|
1573
|
+
déclencheur ; Tab après le dernier élément ferme le panneau et passe à ce qui
|
|
1574
|
+
suit le déclencheur, Maj+Tab avant le premier revient au déclencheur.
|
|
1575
|
+
- **Nom** : le panneau est un `role="dialog"` non modal, nommé par son
|
|
1576
|
+
déclencheur ; passez `aria-label` à `PopoverContent` pour un autre nom.
|
|
1577
|
+
- **Dans une `Modal`** : le panneau reste actif, et son Échap ne ferme pas la
|
|
1578
|
+
modale. Un menu ou une liste ouverts depuis le panneau prennent Échap
|
|
1579
|
+
d'abord, et un clic dedans ne le ferme pas.
|
|
1580
|
+
- **`PopoverTrigger asChild`** fait de l'enfant le déclencheur (un `Button`) :
|
|
1581
|
+
son `onClick` passe d'abord, `preventDefault()` empêche l'ouverture, son
|
|
1582
|
+
`disabled` et sa `ref` sont gardés. `PopoverClose` sans enfant dessine une
|
|
1583
|
+
croix nommée « Close » (libellé `popoverClose`).
|
|
1584
|
+
- La largeur est celle du contenu : donnez-la par `className` (`w-72`). Le
|
|
1585
|
+
padding par défaut est `p-4` ; `p-2!` le remplace (`cn()` ne fusionne pas).
|
|
1586
|
+
|
|
1473
1587
|
### Tooltip
|
|
1474
1588
|
|
|
1475
1589
|
```tsx
|
|
@@ -1490,8 +1604,10 @@ import { Tooltip } from "@synertech/ui";
|
|
|
1490
1604
|
```
|
|
1491
1605
|
|
|
1492
1606
|
Vos propres `onMouseEnter`, `onFocus`, `onClick`… passés au `Tooltip`
|
|
1493
|
-
s'exécutent à côté des siens. La bulle est
|
|
1494
|
-
un parent en `overflow: hidden` la
|
|
1607
|
+
s'exécutent à côté des siens. La bulle est rendue sous le `<body>` du document
|
|
1608
|
+
de son déclencheur : un parent en `overflow: hidden` ne la coupe plus, elle
|
|
1609
|
+
passe de l'autre côté quand celui-ci a plus de place et reste dans la fenêtre.
|
|
1610
|
+
Pour un contenu interactif (un champ, des boutons), prenez un `Popover`.
|
|
1495
1611
|
|
|
1496
1612
|
### Toast
|
|
1497
1613
|
|
|
@@ -2117,8 +2233,7 @@ export function ContactForm() {
|
|
|
2117
2233
|
type="email"
|
|
2118
2234
|
value={formData.email}
|
|
2119
2235
|
onChange={(e) => setFormData(prev => ({ ...prev, email: e.target.value }))}
|
|
2120
|
-
error={!formData.email.includes("@")}
|
|
2121
|
-
helperText="Adresse email valide requise"
|
|
2236
|
+
error={formData.email && !formData.email.includes("@") ? "Adresse email valide requise" : undefined}
|
|
2122
2237
|
/>
|
|
2123
2238
|
<Select
|
|
2124
2239
|
label="Sujet"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";var
|
|
1
|
+
"use strict";"use client";var I=Object.defineProperty;var le=Object.getOwnPropertyDescriptor;var ce=Object.getOwnPropertyNames;var ue=Object.prototype.hasOwnProperty;var de=(s,r)=>{for(var i in r)I(s,i,{get:r[i],enumerable:!0})},pe=(s,r,i,l)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of ce(r))!ue.call(s,n)&&n!==i&&I(s,n,{get:()=>r[n],enumerable:!(l=le(r,n))||l.enumerable});return s};var fe=s=>pe(I({},"__esModule",{value:!0}),s);var ye={};de(ye,{Checkbox:()=>q});module.exports=fe(ye);var c=require("react"),a=require("../../lib/cn.cjs"),j=require("../form/shared/field-error.cjs"),t=require("react/jsx-runtime"),ge=s=>{switch(s){case"sm":return{checkbox:"w-4 h-4",label:"text-xs",description:"text-xs"};case"lg":return{checkbox:"w-6 h-6",label:"text-base",description:"text-sm"};default:return{checkbox:"w-5 h-5",label:"text-sm",description:"text-xs"}}},he=s=>{switch(s){case"circle":return"rounded-full";case"rounded":return"rounded-md";default:return"rounded"}},be=({className:s})=>(0,t.jsx)("svg",{className:s,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"})}),me=({className:s})=>(0,t.jsx)("svg",{className:s,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("path",{d:"M3 8H13",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"})}),R="bg-synertech-primary-600",xe="peer-focus-visible:ring-synertech-primary-500",P=(s,r)=>s.split(/\s+/).filter(Boolean).map(i=>/^[^[]*:/.test(i)?i:`${r}:${i}`).join(" "),q=(0,c.forwardRef)(({checked:s,defaultChecked:r=!1,onChange:i,disabled:l=!1,readOnly:n=!1,required:M=!1,name:B,value:D,id:W,label:m,description:x,error:_,size:$="md",labelPosition:O="right",checkedColor:u=R,uncheckedColor:y="bg-white dark:bg-gray-800",borderColor:g="border-gray-300 dark:border-gray-600",labelColor:S,errorColor:H="text-red-600 dark:text-red-400",checkmarkColor:U,hoverColor:f,focusRingColor:T,indeterminate:o=!1,icon:F,variant:w="default",shape:A="square",animation:k=!0,showFocusRing:z=!0,className:G,containerClassName:K,style:V,tabIndex:J,onClick:Q,"aria-describedby":X,...Y},h)=>{let Z=(0,c.useId)(),N=W||Z,d=(0,j.describeField)(N,{description:m?x:void 0,error:_,own:X}),ee=s!==void 0,b=(0,c.useRef)(null);(0,c.useEffect)(()=>{b.current&&(b.current.indeterminate=o)},[o]);let te=e=>{e.target.indeterminate=o,!(l||n)&&i?.(e.target.checked,e)},se=e=>{Q?.(e),n&&e.preventDefault()},v=ge($),re=he(A),C=f?P(f,"hover"):void 0,ne=T?P(T,"peer-focus-visible"):xe,ae=w==="outlined"&&!l,oe=u===R?"text-synertech-primary-600 dark:text-synertech-primary-400":u.replace(/(^|[\s:])bg-/g,"$1text-"),ie=e=>{let p=(0,a.cn)("relative items-center justify-center border-2 transition-all",v.checkbox,re,k&&"duration-200 ease-in-out");return l?(0,a.cn)(p,"opacity-50 cursor-not-allowed",e||o?u:y,g):w==="filled"?(0,a.cn)(p,e||o?u:"bg-gray-100 dark:bg-gray-700",e||o?"border-transparent":g,f&&!n&&C,"cursor-pointer"):w==="outlined"?(0,a.cn)(p,y,e||o?`border-current ${oe}`:g,"border-2",f&&!n&&C,"cursor-pointer"):(0,a.cn)(p,e||o?u:y,e||o?"border-transparent":g,f&&!n&&C,"cursor-pointer")},E=d.invalid,L=(e,p)=>(0,t.jsx)("span",{className:(0,a.cn)(ie(e),z&&"peer-focus-visible:ring-2 peer-focus-visible:ring-offset-2",z&&ne,k&&e&&"scale-100",E&&"border-red-500",G,p),"aria-hidden":"true",children:e&&(0,t.jsx)("span",{className:(0,a.cn)(U??(ae?void 0:u===R?"text-synertech-on-primary":"text-white"),k&&"animate-in zoom-in-50 duration-200"),children:o?F||(0,t.jsx)(me,{className:"w-full h-full"}):F||(0,t.jsx)(be,{className:"w-full h-full"})})});return(0,t.jsxs)("div",{className:(0,a.cn)("inline-flex flex-col",K),children:[(0,t.jsxs)("label",{htmlFor:N,className:(0,a.cn)("inline-flex items-start gap-2",l?"cursor-not-allowed":"cursor-pointer",O==="left"&&"flex-row-reverse justify-end"),children:[(0,t.jsx)("input",{ref:e=>{b&&(b.current=e),typeof h=="function"?h(e):h&&(h.current=e)},type:"checkbox",id:N,name:B,value:D,...ee?{checked:s}:{defaultChecked:r},onChange:te,onClick:se,disabled:l,readOnly:n,required:M,tabIndex:n?-1:J,"aria-invalid":E||void 0,"aria-describedby":d.describedBy,className:"sr-only peer",style:V,...Y}),o?L(!0,"flex"):(0,t.jsxs)(t.Fragment,{children:[L(!1,"flex peer-checked:hidden"),L(!0,"hidden peer-checked:flex")]}),m&&(0,t.jsxs)("span",{className:"flex flex-col gap-1",children:[(0,t.jsxs)("span",{className:(0,a.cn)(v.label,l&&"opacity-50",S,E&&H),children:[m,M&&(0,t.jsx)("span",{className:"text-red-600 dark:text-red-400 ml-1","aria-hidden":"true",children:"*"})]}),x&&(0,t.jsx)("span",{id:d.ids.description,className:(0,a.cn)(v.description,"text-gray-500 dark:text-gray-400",l&&"opacity-50"),children:x})]})]}),d.message!==void 0&&(0,t.jsx)("p",{id:d.ids.error,className:(0,a.cn)("mt-1 text-xs",H),children:d.message})]})});q.displayName="Checkbox";0&&(module.exports={Checkbox});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{forwardRef as ae,useId as
|
|
1
|
+
"use client";import{forwardRef as ae,useId as oe,useEffect as ie,useRef as le}from"react";import{cn as s}from"../../lib/cn.js";import{describeField as ce}from"../form/shared/field-error.js";import{Fragment as be,jsx as r,jsxs as p}from"react/jsx-runtime";var ue=t=>{switch(t){case"sm":return{checkbox:"w-4 h-4",label:"text-xs",description:"text-xs"};case"lg":return{checkbox:"w-6 h-6",label:"text-base",description:"text-sm"};default:return{checkbox:"w-5 h-5",label:"text-sm",description:"text-xs"}}},de=t=>{switch(t){case"circle":return"rounded-full";case"rounded":return"rounded-md";default:return"rounded"}},pe=({className:t})=>r("svg",{className:t,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:r("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"})}),fe=({className:t})=>r("svg",{className:t,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:r("path",{d:"M3 8H13",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"})}),I="bg-synertech-primary-600",ge="peer-focus-visible:ring-synertech-primary-500",z=(t,b)=>t.split(/\s+/).filter(Boolean).map(u=>/^[^[]*:/.test(u)?u:`${b}:${u}`).join(" "),he=ae(({checked:t,defaultChecked:b=!1,onChange:u,disabled:a=!1,readOnly:o=!1,required:R=!1,name:P,value:j,id:q,label:m,description:x,error:B,size:D="md",labelPosition:W="right",checkedColor:i=I,uncheckedColor:y="bg-white dark:bg-gray-800",borderColor:f="border-gray-300 dark:border-gray-600",labelColor:_,errorColor:M="text-red-600 dark:text-red-400",checkmarkColor:$,hoverColor:d,focusRingColor:H,indeterminate:n=!1,icon:T,variant:w="default",shape:O="square",animation:k=!0,showFocusRing:F=!0,className:S,containerClassName:U,style:A,tabIndex:G,onClick:K,"aria-describedby":V,...J},g)=>{let Q=oe(),N=q||Q,l=ce(N,{description:m?x:void 0,error:B,own:V}),X=t!==void 0,h=le(null);ie(()=>{h.current&&(h.current.indeterminate=n)},[n]);let Y=e=>{e.target.indeterminate=n,!(a||o)&&u?.(e.target.checked,e)},Z=e=>{K?.(e),o&&e.preventDefault()},v=ue(D),ee=de(O),C=d?z(d,"hover"):void 0,te=H?z(H,"peer-focus-visible"):ge,se=w==="outlined"&&!a,re=i===I?"text-synertech-primary-600 dark:text-synertech-primary-400":i.replace(/(^|[\s:])bg-/g,"$1text-"),ne=e=>{let c=s("relative items-center justify-center border-2 transition-all",v.checkbox,ee,k&&"duration-200 ease-in-out");return a?s(c,"opacity-50 cursor-not-allowed",e||n?i:y,f):w==="filled"?s(c,e||n?i:"bg-gray-100 dark:bg-gray-700",e||n?"border-transparent":f,d&&!o&&C,"cursor-pointer"):w==="outlined"?s(c,y,e||n?`border-current ${re}`:f,"border-2",d&&!o&&C,"cursor-pointer"):s(c,e||n?i:y,e||n?"border-transparent":f,d&&!o&&C,"cursor-pointer")},E=l.invalid,L=(e,c)=>r("span",{className:s(ne(e),F&&"peer-focus-visible:ring-2 peer-focus-visible:ring-offset-2",F&&te,k&&e&&"scale-100",E&&"border-red-500",S,c),"aria-hidden":"true",children:e&&r("span",{className:s($??(se?void 0:i===I?"text-synertech-on-primary":"text-white"),k&&"animate-in zoom-in-50 duration-200"),children:n?T||r(fe,{className:"w-full h-full"}):T||r(pe,{className:"w-full h-full"})})});return p("div",{className:s("inline-flex flex-col",U),children:[p("label",{htmlFor:N,className:s("inline-flex items-start gap-2",a?"cursor-not-allowed":"cursor-pointer",W==="left"&&"flex-row-reverse justify-end"),children:[r("input",{ref:e=>{h&&(h.current=e),typeof g=="function"?g(e):g&&(g.current=e)},type:"checkbox",id:N,name:P,value:j,...X?{checked:t}:{defaultChecked:b},onChange:Y,onClick:Z,disabled:a,readOnly:o,required:R,tabIndex:o?-1:G,"aria-invalid":E||void 0,"aria-describedby":l.describedBy,className:"sr-only peer",style:A,...J}),n?L(!0,"flex"):p(be,{children:[L(!1,"flex peer-checked:hidden"),L(!0,"hidden peer-checked:flex")]}),m&&p("span",{className:"flex flex-col gap-1",children:[p("span",{className:s(v.label,a&&"opacity-50",_,E&&M),children:[m,R&&r("span",{className:"text-red-600 dark:text-red-400 ml-1","aria-hidden":"true",children:"*"})]}),x&&r("span",{id:l.ids.description,className:s(v.description,"text-gray-500 dark:text-gray-400",a&&"opacity-50"),children:x})]})]}),l.message!==void 0&&r("p",{id:l.ids.error,className:s("mt-1 text-xs",M),children:l.message})]})});he.displayName="Checkbox";export{he as Checkbox};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";var
|
|
1
|
+
"use strict";"use client";var K=Object.create;var b=Object.defineProperty;var Q=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var X=Object.getPrototypeOf,Y=Object.prototype.hasOwnProperty;var Z=(e,t)=>{for(var o in t)b(e,o,{get:t[o],enumerable:!0})},z=(e,t,o,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of U(t))!Y.call(e,a)&&a!==o&&b(e,a,{get:()=>t[a],enumerable:!(i=Q(t,a))||i.enumerable});return e};var _=(e,t,o)=>(o=e!=null?K(X(e)):{},z(t||!e||!e.__esModule?b(o,"default",{value:e,enumerable:!0}):o,e)),$=e=>z(b({},"__esModule",{value:!0}),e);var j={};Z(j,{CheckboxGroup:()=>L,CheckboxGroupItem:()=>D});module.exports=$(j);var m=require("react"),g=require("../../lib/cn.cjs"),E=require("../form/shared/field-error.cjs"),G=require("./Checkbox.cjs"),s=_(require("react"),1),r=require("react/jsx-runtime"),V=(0,m.createContext)(null),L=({label:e,description:t,value:o,defaultValue:i=[],onChange:a,name:f,orientation:c="vertical",spacing:v="md",disabled:d=!1,size:h="md",error:k,required:y=!1,children:q,className:M,labelClassName:S,...A})=>{let[H,P]=s.useState(i),x=o!==void 0,u=x?o:H,I=s.useRef(null);s.useEffect(()=>{if(x)return;let l=I.current,p=l?.querySelector("input")?.form;if(!l||!p)return;let C,w=()=>{C=setTimeout(()=>{let J=l.querySelectorAll('input[type="checkbox"]');P(Array.from(J).filter(R=>R.checked).map(R=>R.value))},0)};return p.addEventListener("reset",w),()=>{p.removeEventListener("reset",w),clearTimeout(C)}},[x]);let T=s.useCallback(l=>{let p=u.includes(l)?u.filter(C=>C!==l):[...u,l];x||P(p),a?.(p)},[u,x,a]),O=s.useMemo(()=>({value:u,onChange:T,name:f,disabled:d,size:h}),[u,T,f,d,h]),W={sm:c==="vertical"?"gap-2":"gap-3",md:c==="vertical"?"gap-3":"gap-4",lg:c==="vertical"?"gap-4":"gap-6"},B=(0,m.useId)(),n=(0,E.describeField)(B,{description:t,error:k}),F=n.invalid,N=e!=null&&e!==""&&typeof e!="boolean";return(0,r.jsxs)("div",{className:(0,g.cn)("flex flex-col gap-2",M),...A,children:[(N||n.hasDescription)&&(0,r.jsxs)("div",{className:"flex flex-col gap-1",children:[N&&(0,r.jsxs)("span",{id:n.ids.label,className:(0,g.cn)("text-sm font-medium text-gray-900 dark:text-gray-100",d&&"opacity-50",F&&"text-red-600 dark:text-red-400",S),children:[e,y&&(0,r.jsx)("span",{className:"text-red-600 dark:text-red-400 ml-1","aria-hidden":"true",children:"*"})]}),n.hasDescription&&(0,r.jsx)("p",{id:n.ids.description,className:(0,g.cn)("text-xs text-gray-500 dark:text-gray-400",d&&"opacity-50"),children:t})]}),(0,r.jsx)(V.Provider,{value:O,children:(0,r.jsx)("div",{ref:I,className:(0,g.cn)("flex",c==="vertical"?"flex-col":"flex-row flex-wrap",W[v]),role:"group","aria-labelledby":N?n.ids.label:void 0,"aria-describedby":n.describedBy,children:q})}),n.message!==void 0&&(0,r.jsx)("p",{id:n.ids.error,className:"text-xs text-red-600 dark:text-red-400",children:n.message})]})};L.displayName="CheckboxGroup";var D=({value:e,disabled:t,size:o,...i})=>{let a=(0,m.useContext)(V);if(!a)return console.warn("CheckboxGroupItem doit \xEAtre utilis\xE9 dans un CheckboxGroup"),(0,r.jsx)(G.Checkbox,{...i,value:e,disabled:t,size:o});let{value:f,onChange:c,name:v,disabled:d,size:h}=a,k=f.includes(e),y=d||t;return(0,r.jsx)(G.Checkbox,{...i,value:e,name:i.name??v,checked:k,onChange:()=>c(e),disabled:y,size:o||h})};D.displayName="CheckboxGroupItem";0&&(module.exports={CheckboxGroup,CheckboxGroupItem});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{createContext as
|
|
1
|
+
"use client";import{createContext as O,useContext as W,useId as B}from"react";import{cn as h}from"../../lib/cn.js";import{describeField as F}from"../form/shared/field-error.js";import{Checkbox as T}from"./Checkbox.js";import*as o from"react";import{jsx as a,jsxs as N}from"react/jsx-runtime";var w=O(null),J=({label:e,description:c,value:d,defaultValue:u=[],onChange:p,name:x,orientation:n="vertical",spacing:C="md",disabled:s=!1,size:g="md",error:b,required:v=!1,children:z,className:E,labelClassName:V,...L})=>{let[D,R]=o.useState(u),m=d!==void 0,i=m?d:D,G=o.useRef(null);o.useEffect(()=>{if(m)return;let r=G.current,l=r?.querySelector("input")?.form;if(!r||!l)return;let f,I=()=>{f=setTimeout(()=>{let H=r.querySelectorAll('input[type="checkbox"]');R(Array.from(H).filter(y=>y.checked).map(y=>y.value))},0)};return l.addEventListener("reset",I),()=>{l.removeEventListener("reset",I),clearTimeout(f)}},[m]);let P=o.useCallback(r=>{let l=i.includes(r)?i.filter(f=>f!==r):[...i,r];m||R(l),p?.(l)},[i,m,p]),q=o.useMemo(()=>({value:i,onChange:P,name:x,disabled:s,size:g}),[i,P,x,s,g]),M={sm:n==="vertical"?"gap-2":"gap-3",md:n==="vertical"?"gap-3":"gap-4",lg:n==="vertical"?"gap-4":"gap-6"},S=B(),t=F(S,{description:c,error:b}),A=t.invalid,k=e!=null&&e!==""&&typeof e!="boolean";return N("div",{className:h("flex flex-col gap-2",E),...L,children:[(k||t.hasDescription)&&N("div",{className:"flex flex-col gap-1",children:[k&&N("span",{id:t.ids.label,className:h("text-sm font-medium text-gray-900 dark:text-gray-100",s&&"opacity-50",A&&"text-red-600 dark:text-red-400",V),children:[e,v&&a("span",{className:"text-red-600 dark:text-red-400 ml-1","aria-hidden":"true",children:"*"})]}),t.hasDescription&&a("p",{id:t.ids.description,className:h("text-xs text-gray-500 dark:text-gray-400",s&&"opacity-50"),children:c})]}),a(w.Provider,{value:q,children:a("div",{ref:G,className:h("flex",n==="vertical"?"flex-col":"flex-row flex-wrap",M[C]),role:"group","aria-labelledby":k?t.ids.label:void 0,"aria-describedby":t.describedBy,children:z})}),t.message!==void 0&&a("p",{id:t.ids.error,className:"text-xs text-red-600 dark:text-red-400",children:t.message})]})};J.displayName="CheckboxGroup";var K=({value:e,disabled:c,size:d,...u})=>{let p=W(w);if(!p)return console.warn("CheckboxGroupItem doit \xEAtre utilis\xE9 dans un CheckboxGroup"),a(T,{...u,value:e,disabled:c,size:d});let{value:x,onChange:n,name:C,disabled:s,size:g}=p,b=x.includes(e),v=s||c;return a(T,{...u,value:e,name:u.name??C,checked:b,onChange:()=>n(e),disabled:v,size:d||g})};K.displayName="CheckboxGroupItem";export{J as CheckboxGroup,K as CheckboxGroupItem};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";"use client";var S=Object.defineProperty;var Pe=Object.getOwnPropertyDescriptor;var ke=Object.getOwnPropertyNames;var Ie=Object.prototype.hasOwnProperty;var Se=(l,t)=>{for(var s in t)S(l,s,{get:t[s],enumerable:!0})},we=(l,t,s,p)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of ke(t))!Ie.call(l,i)&&i!==s&&S(l,i,{get:()=>t[i],enumerable:!(p=Pe(t,i))||p.enumerable});return l};var Te=l=>we(S({},"__esModule",{value:!0}),l);var Ee={};Se(Ee,{DatePicker:()=>Q});module.exports=Te(Ee);var r=require("react"),U=require("../../lib/cn.cjs"),g=require("../../lib/i18n.cjs"),V=require("../calendar/Calendar.cjs"),A=require("../form/shared/field-error.cjs"),G=require("../form/shared/inputStyles.cjs"),J=require("../form/shared/InputWrapper.cjs"),d=require("../popover/index.cjs"),n=require("./date-field.cjs"),u=require("./date-input.cjs"),a=require("react/jsx-runtime"),Q=(0,r.forwardRef)(function({value:t,defaultValue:s,onChange:p,label:i,hideLabel:X=!1,description:T,helperText:E,error:L,required:O=!1,inline:Z=!1,size:b="md",placeholder:_,name:F,minDate:N,maxDate:W,disabledDates:x,weekStartsOn:$,locale:j,today:B,captionLayout:ee,fromYear:te,toYear:ne,openLabel:K,disabled:y=!1,readOnly:h=!1,id:ae,className:le,onBlur:re,onKeyDown:oe,"aria-describedby":ie,...se},de){let c=(0,g.useUILabels)(),m=(0,g.useUILocale)(j),ue=(0,r.useId)(),v=ae||ue,z=t!==void 0,[pe,ce]=(0,r.useState)(()=>(0,n.dayOrNull)(s)),o=z?(0,n.dayOrNull)(t):pe,[f,D]=(0,r.useState)(null),[M,C]=(0,r.useState)(),[me,P]=(0,r.useState)(!1),[fe,De]=(0,r.useState)(o),[Y,ge]=(0,r.useState)(void 0);w(o,fe)||(De(o),(Y===void 0||!w(o,Y))&&(D(null),C(void 0)));let be={minDate:N,maxDate:W,disabledDates:x},ye=f??(o?(0,u.formatDateInput)(o,m):""),H=!y&&!h,k=(0,A.describeField)(v,{description:T,helperText:E,error:M??L,own:ie}),R=e=>{z||ce(e),ge(e),w(e,o)||p?.(e)},I=()=>{if(f===null)return;let e=(0,n.readTypedDate)(f,{locale:m,labels:c,today:B,rules:be});C(e.message),e.message===void 0&&D(null),R(e.date)},he=e=>{e&&(D(null),C(void 0),R(e)),P(!1)},ve=e=>{I(),re?.(e)},Ce=e=>{oe?.(e),!e.defaultPrevented&&(e.key==="Enter"&&f!==null?(e.preventDefault(),I()):e.key==="ArrowDown"&&e.altKey&&H&&(e.preventDefault(),I(),P(!0)))},q=n.triggerSizeClasses[b];return(0,a.jsxs)(J.InputWrapper,{label:i,hideLabel:X,description:T,helperText:E,error:M??L,required:O,inline:Z,htmlFor:v,children:[(0,a.jsxs)(d.Popover,{open:me,onOpenChange:P,children:[(0,a.jsxs)("div",{className:"relative w-full",children:[(0,a.jsx)("input",{...se,ref:de,id:v,type:"text",inputMode:"numeric",autoComplete:"off",value:ye,placeholder:_??(0,n.placeholderFor)(m,c),disabled:y,readOnly:h,onChange:e=>D(e.target.value),onBlur:ve,onKeyDown:Ce,"aria-invalid":k.invalid||void 0,"aria-describedby":k.describedBy,"aria-required":O||void 0,className:(0,U.cn)((0,G.getBaseInputClasses)({size:b,error:k.invalid,disabled:y,readOnly:h}),q.padding,le)}),(0,a.jsx)(d.PopoverTrigger,{asChild:!0,children:(0,a.jsx)("button",{type:"button",disabled:!H,"aria-label":K??c.datePickerOpen,className:n.triggerButtonClasses,children:(0,a.jsx)(n.CalendarIcon,{className:q.icon})})})]}),(0,a.jsx)(d.PopoverContent,{side:"bottom",align:"end","aria-label":i||(K??c.datePickerOpen),initialFocus:n.calendarTabStop,children:(0,a.jsx)(V.Calendar,{mode:"single",value:o,onChange:he,minDate:N,maxDate:W,disabledDates:x,weekStartsOn:$,locale:m,today:B,captionLayout:ee,fromYear:te,toYear:ne,size:b==="sm"?"sm":"md",bordered:!1,className:"-m-4"})})]}),F?(0,a.jsx)("input",{type:"hidden",name:F,value:o?(0,u.toISODate)(o):""}):null]})});Q.displayName="DatePicker";function w(l,t){return l===null?t===null:(0,u.isSameDay)(l,t)}0&&(module.exports={DatePicker});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{forwardRef as me,useId as fe,useState as a}from"react";import{cn as De}from"../../lib/cn.js";import{useUILabels as ge,useUILocale as be}from"../../lib/i18n.js";import{Calendar as ye}from"../calendar/Calendar.js";import{describeField as he}from"../form/shared/field-error.js";import{getBaseInputClasses as ve}from"../form/shared/inputStyles.js";import{InputWrapper as Ce}from"../form/shared/InputWrapper.js";import{Popover as Pe,PopoverContent as ke,PopoverTrigger as Ie}from"../popover/index.js";import{CalendarIcon as Se,calendarTabStop as we,dayOrNull as z,placeholderFor as Te,readTypedDate as Ee,triggerButtonClasses as Le,triggerSizeClasses as Oe}from"./date-field.js";import{formatDateInput as Fe,isSameDay as Ne,toISODate as We}from"./date-input.js";import{jsx as n,jsxs as h}from"react/jsx-runtime";var xe=me(function({value:l,defaultValue:M,onChange:Y,label:v,hideLabel:H=!1,description:C,helperText:P,error:k,required:I=!1,inline:R=!1,size:u="md",placeholder:q,name:S,minDate:w,maxDate:T,disabledDates:E,weekStartsOn:U,locale:V,today:L,captionLayout:A,fromYear:G,toYear:J,openLabel:O,disabled:p=!1,readOnly:c=!1,id:Q,className:X,onBlur:Z,onKeyDown:_,"aria-describedby":$,...j},ee){let r=ge(),o=be(V),te=fe(),m=Q||te,F=l!==void 0,[ne,ae]=a(()=>z(M)),t=F?z(l):ne,[i,s]=a(null),[N,f]=a(),[le,D]=a(!1),[re,oe]=a(t),[W,ie]=a(void 0);y(t,re)||(oe(t),(W===void 0||!y(t,W))&&(s(null),f(void 0)));let se={minDate:w,maxDate:T,disabledDates:E},de=i??(t?Fe(t,o):""),x=!p&&!c,g=he(m,{description:C,helperText:P,error:N??k,own:$}),B=e=>{F||ae(e),ie(e),y(e,t)||Y?.(e)},b=()=>{if(i===null)return;let e=Ee(i,{locale:o,labels:r,today:L,rules:se});f(e.message),e.message===void 0&&s(null),B(e.date)},ue=e=>{e&&(s(null),f(void 0),B(e)),D(!1)},pe=e=>{b(),Z?.(e)},ce=e=>{_?.(e),!e.defaultPrevented&&(e.key==="Enter"&&i!==null?(e.preventDefault(),b()):e.key==="ArrowDown"&&e.altKey&&x&&(e.preventDefault(),b(),D(!0)))},K=Oe[u];return h(Ce,{label:v,hideLabel:H,description:C,helperText:P,error:N??k,required:I,inline:R,htmlFor:m,children:[h(Pe,{open:le,onOpenChange:D,children:[h("div",{className:"relative w-full",children:[n("input",{...j,ref:ee,id:m,type:"text",inputMode:"numeric",autoComplete:"off",value:de,placeholder:q??Te(o,r),disabled:p,readOnly:c,onChange:e=>s(e.target.value),onBlur:pe,onKeyDown:ce,"aria-invalid":g.invalid||void 0,"aria-describedby":g.describedBy,"aria-required":I||void 0,className:De(ve({size:u,error:g.invalid,disabled:p,readOnly:c}),K.padding,X)}),n(Ie,{asChild:!0,children:n("button",{type:"button",disabled:!x,"aria-label":O??r.datePickerOpen,className:Le,children:n(Se,{className:K.icon})})})]}),n(ke,{side:"bottom",align:"end","aria-label":v||(O??r.datePickerOpen),initialFocus:we,children:n(ye,{mode:"single",value:t,onChange:ue,minDate:w,maxDate:T,disabledDates:E,weekStartsOn:U,locale:o,today:L,captionLayout:A,fromYear:G,toYear:J,size:u==="sm"?"sm":"md",bordered:!1,className:"-m-4"})})]}),S?n("input",{type:"hidden",name:S,value:t?We(t):""}):null]})});xe.displayName="DatePicker";function y(d,l){return d===null?l===null:Ne(d,l)}export{xe as DatePicker};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";"use client";var _=Object.defineProperty;var Ge=Object.getOwnPropertyDescriptor;var Je=Object.getOwnPropertyNames;var Xe=Object.prototype.hasOwnProperty;var Ze=(a,r)=>{for(var m in r)_(a,m,{get:r[m],enumerable:!0})},je=(a,r,m,h)=>{if(r&&typeof r=="object"||typeof r=="function")for(let f of Je(r))!Xe.call(a,f)&&f!==m&&_(a,f,{get:()=>r[f],enumerable:!(h=Ge(r,f))||h.enumerable});return a};var ea=a=>je(_({},"__esModule",{value:!0}),a);var na={};Ze(na,{DateRangePicker:()=>ve});module.exports=ea(na);var s=require("react"),V=require("../../lib/cn.cjs"),N=require("../../lib/i18n.cjs"),ye=require("../calendar/Calendar.cjs"),De=require("../chart/utils/period.cjs"),G=require("../form/shared/field-error.cjs"),Pe=require("../form/shared/inputStyles.cjs"),he=require("../form/shared/InputWrapper.cjs"),y=require("../popover/index.cjs"),n=require("./date-field.cjs"),u=require("./date-input.cjs"),t=require("react/jsx-runtime"),aa={"7d":"chartPeriodLast7Days","30d":"chartPeriodLast30Days","90d":"chartPeriodLast90Days","12m":"chartPeriodLast12Months",mtd:"chartPeriodMonthToDate",qtd:"chartPeriodQuarterToDate",ytd:"chartPeriodYearToDate"};function Q(a){return{from:(0,n.dayOrNull)(a?.from),to:(0,n.dayOrNull)(a?.to)}}function be(a,r){return a===null?r===null:(0,u.isSameDay)(a,r)}function L(a,r){return be(a.from,r.from)&&be(a.to,r.to)}function ta(a){return a.from&&a.to&&a.to<a.from?{from:a.to,to:a.from}:a}var ve=(0,s.forwardRef)(function({value:r,defaultValue:m,onChange:h,presets:f=[],label:S,hideLabel:Re=!1,description:J,helperText:X,error:O,required:Z=!1,inline:Ce=!1,size:E="md",placeholder:ke,startName:j,endName:ee,minDate:T,maxDate:$,disabledDates:ae,weekStartsOn:xe,locale:Ie,today:B,numberOfMonths:we=1,captionLayout:Le,fromYear:Ne,toYear:Se,disabled:K=!1,readOnly:M=!1,id:Oe,className:Ee,onBlur:te,labels:Te},$e){let c=(0,N.useUILabels)(Te),D=(0,N.useUILocale)(Ie),v=(0,s.useId)(),P=Oe||`${v}-start`,Be=`${v}-end`,F=`${v}-start-name`,U=`${v}-end-name`,ne=r!==void 0,[Ke,Me]=(0,s.useState)(()=>Q(m)),o=ne?Q(r):Ke,[Y,p]=(0,s.useState)(null),[z,g]=(0,s.useState)(null),[W,R]=(0,s.useState)(),[q,C]=(0,s.useState)(),[Fe,k]=(0,s.useState)(!1),[Ue,x]=(0,s.useState)(null),[Ye,ze]=(0,s.useState)(o),[re,We]=(0,s.useState)(void 0);L(o,Ye)||(ze(o),(re===void 0||!L(o,re))&&(p(null),g(null),R(void 0),C(void 0)));let qe={minDate:T,maxDate:$,disabledDates:ae},oe=!K&&!M,le=W??q,Ae=(0,G.describeField)(P,{description:J,helperText:X,error:le??O}),I=(0,G.describeField)(P,{error:O}).invalid,se=!!S,ie=`${P}-label`,A=e=>{ne||Me(e),We(e),L(e,o)||h?.(e)},w=e=>{let l=e==="from"?Y:z;if(l===null)return;let i=(0,n.readTypedDate)(l,{locale:D,labels:c,today:B,rules:qe});(e==="from"?R:C)(i.message),i.message===void 0&&(e==="from"?p:g)(null);let d={...o,[e]:i.date},b=ta(d);b!==d&&(p(null),g(null)),A(b)},He=e=>{x(e),!(!e.from||!e.to)&&(p(null),g(null),R(void 0),C(void 0),x(null),A(Q(e)),k(!1))},de=B??new Date,ue=f.map(e=>{let l=typeof e=="string"?(0,De.resolvePeriodPreset)(e,de):{from:e.from,to:e.to},i=(0,n.dayOrNull)(l.from),d=(0,n.dayOrNull)(l.to),b=(0,n.dayOrNull)(T),H=(0,n.dayOrNull)($);i&&b&&i<b&&(i=b),d&&H&&d>H&&(d=H);let ge={from:i,to:d};return{key:typeof e=="string"?e:`${e.label}-${(0,u.toISODate)(ge.from??de)}`,caption:typeof e=="string"?c[aa[e]]:e.label,range:ge,usable:!!(i&&d&&i<=d)}}),_e=e=>{p(null),g(null),R(void 0),C(void 0),x(null),A(e),k(!1)},Qe=e=>{e||x(null),k(e)},ce=e=>l=>{let i=e==="from"?Y:z;l.key==="Enter"&&i!==null?(l.preventDefault(),w(e)):l.key==="ArrowDown"&&l.altKey&&oe&&(l.preventDefault(),w(e),k(!0))},fe=n.triggerSizeClasses[E],Ve=ke??(0,n.placeholderFor)(D,c),me=e=>(0,Pe.getBaseInputClasses)({size:E,error:e,disabled:K,readOnly:M}),pe={type:"text",inputMode:"numeric",autoComplete:"off",placeholder:Ve,disabled:K,readOnly:M,"aria-describedby":Ae.describedBy,"aria-required":Z||void 0};return(0,t.jsx)("div",{className:Ee,children:(0,t.jsxs)(he.InputWrapper,{label:S,hideLabel:Re,description:J,helperText:X,error:le??O,required:Z,inline:Ce,htmlFor:P,children:[(0,t.jsxs)(y.Popover,{open:Fe,onOpenChange:Qe,children:[(0,t.jsxs)("div",{className:"flex w-full items-center gap-2",children:[(0,t.jsx)("div",{className:"min-w-0 flex-1",children:(0,t.jsx)("input",{...pe,ref:$e,id:P,value:Y??(o.from?(0,u.formatDateInput)(o.from,D):""),onChange:e=>p(e.target.value),onBlur:()=>{w("from"),te?.()},onKeyDown:ce("from"),"aria-labelledby":se?`${ie} ${F}`:F,"aria-invalid":I||W!==void 0||void 0,className:me(I||W!==void 0)})}),(0,t.jsx)("span",{"aria-hidden":"true",className:"text-gray-500 dark:text-gray-400",children:"\u2013"}),(0,t.jsxs)("div",{className:"relative min-w-0 flex-1",children:[(0,t.jsx)("input",{...pe,id:Be,value:z??(o.to?(0,u.formatDateInput)(o.to,D):""),onChange:e=>g(e.target.value),onBlur:()=>{w("to"),te?.()},onKeyDown:ce("to"),"aria-labelledby":se?`${ie} ${U}`:U,"aria-invalid":I||q!==void 0||void 0,className:(0,V.cn)(me(I||q!==void 0),fe.padding)}),(0,t.jsx)(y.PopoverTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",disabled:!oe,"aria-label":c.dateRangePickerOpen,className:n.triggerButtonClasses,children:(0,t.jsx)(n.CalendarIcon,{className:fe.icon})})})]})]}),(0,t.jsx)("span",{id:F,hidden:!0,children:c.dateRangePickerStart}),(0,t.jsx)("span",{id:U,hidden:!0,children:c.dateRangePickerEnd}),(0,t.jsx)(y.PopoverContent,{side:"bottom",align:"end","aria-label":S||c.dateRangePickerOpen,initialFocus:n.calendarTabStop,children:(0,t.jsxs)("div",{className:"-m-4 flex flex-col bg-white sm:flex-row dark:bg-gray-900",children:[ue.length>0?(0,t.jsx)("div",{role:"group","aria-label":c.dateRangePickerPresets,className:"flex min-w-40 flex-col gap-0.5 border-b border-gray-200 p-2 sm:border-r sm:border-b-0 dark:border-gray-700",children:ue.map(e=>{let l=e.usable&&o.from&&o.to&&L(e.range,o);return(0,t.jsx)("button",{type:"button",disabled:!e.usable,"aria-pressed":!!l,onClick:()=>_e(e.range),className:(0,V.cn)("cursor-pointer rounded-md px-3 py-1.5 text-left text-sm text-gray-700 hover:bg-gray-100 focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-synertech-primary-500 disabled:cursor-not-allowed disabled:text-gray-400 dark:text-gray-200 dark:hover:bg-gray-800 dark:disabled:text-gray-600",l&&"bg-synertech-primary-50 font-medium text-synertech-primary-700 dark:bg-synertech-primary-950 dark:text-synertech-primary-300"),children:e.caption},e.key)})}):null,(0,t.jsx)(ye.Calendar,{mode:"range",value:Ue??o,onChange:He,numberOfMonths:we,minDate:T,maxDate:$,disabledDates:ae,weekStartsOn:xe,locale:D,today:B,captionLayout:Le,fromYear:Ne,toYear:Se,size:E==="sm"?"sm":"md",bordered:!1})]})})]}),j?(0,t.jsx)("input",{type:"hidden",name:j,value:o.from?(0,u.toISODate)(o.from):""}):null,ee?(0,t.jsx)("input",{type:"hidden",name:ee,value:o.to?(0,u.toISODate)(o.to):""}):null]})})});ve.displayName="DateRangePicker";0&&(module.exports={DateRangePicker});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{forwardRef as qe,useId as Ae,useState as s}from"react";import{cn as de}from"../../lib/cn.js";import{useUILabels as He,useUILocale as _e}from"../../lib/i18n.js";import{Calendar as Qe}from"../calendar/Calendar.js";import{resolvePeriodPreset as Ve}from"../chart/utils/period.js";import{describeField as ue}from"../form/shared/field-error.js";import{getBaseInputClasses as Ge}from"../form/shared/inputStyles.js";import{InputWrapper as Je}from"../form/shared/InputWrapper.js";import{Popover as Xe,PopoverContent as Ze,PopoverTrigger as je}from"../popover/index.js";import{CalendarIcon as ea,calendarTabStop as aa,dayOrNull as m,placeholderFor as ta,readTypedDate as na,triggerButtonClasses as ra,triggerSizeClasses as oa}from"./date-field.js";import{formatDateInput as ce,isSameDay as la,toISODate as z}from"./date-input.js";import{jsx as n,jsxs as b}from"react/jsx-runtime";var sa={"7d":"chartPeriodLast7Days","30d":"chartPeriodLast30Days","90d":"chartPeriodLast90Days","12m":"chartPeriodLast12Months",mtd:"chartPeriodMonthToDate",qtd:"chartPeriodQuarterToDate",ytd:"chartPeriodYearToDate"};function W(t){return{from:m(t?.from),to:m(t?.to)}}function fe(t,i){return t===null?i===null:la(t,i)}function k(t,i){return fe(t.from,i.from)&&fe(t.to,i.to)}function ia(t){return t.from&&t.to&&t.to<t.from?{from:t.to,to:t.from}:t}var da=qe(function({value:i,defaultValue:me,onChange:pe,presets:ge=[],label:x,hideLabel:be=!1,description:q,helperText:A,error:I,required:H=!1,inline:ye=!1,size:w="md",placeholder:De,startName:_,endName:Q,minDate:L,maxDate:N,disabledDates:V,weekStartsOn:Pe,locale:he,today:S,numberOfMonths:ve=1,captionLayout:Re,fromYear:Ce,toYear:ke,disabled:O=!1,readOnly:E=!1,id:xe,className:Ie,onBlur:G,labels:we},Le){let d=He(we),p=_e(he),y=Ae(),g=xe||`${y}-start`,Ne=`${y}-end`,T=`${y}-start-name`,$=`${y}-end-name`,J=i!==void 0,[Se,Oe]=s(()=>W(me)),a=J?W(i):Se,[B,u]=s(null),[K,c]=s(null),[M,D]=s(),[F,P]=s(),[Ee,h]=s(!1),[Te,v]=s(null),[$e,Be]=s(a),[X,Ke]=s(void 0);k(a,$e)||(Be(a),(X===void 0||!k(a,X))&&(u(null),c(null),D(void 0),P(void 0)));let Me={minDate:L,maxDate:N,disabledDates:V},Z=!O&&!E,j=M??F,Fe=ue(g,{description:q,helperText:A,error:j??I}),R=ue(g,{error:I}).invalid,ee=!!x,ae=`${g}-label`,U=e=>{J||Oe(e),Ke(e),k(e,a)||pe?.(e)},C=e=>{let r=e==="from"?B:K;if(r===null)return;let o=na(r,{locale:p,labels:d,today:S,rules:Me});(e==="from"?D:P)(o.message),o.message===void 0&&(e==="from"?u:c)(null);let l={...a,[e]:o.date},f=ia(l);f!==l&&(u(null),c(null)),U(f)},Ue=e=>{v(e),!(!e.from||!e.to)&&(u(null),c(null),D(void 0),P(void 0),v(null),U(W(e)),h(!1))},te=S??new Date,ne=ge.map(e=>{let r=typeof e=="string"?Ve(e,te):{from:e.from,to:e.to},o=m(r.from),l=m(r.to),f=m(L),Y=m(N);o&&f&&o<f&&(o=f),l&&Y&&l>Y&&(l=Y);let ie={from:o,to:l};return{key:typeof e=="string"?e:`${e.label}-${z(ie.from??te)}`,caption:typeof e=="string"?d[sa[e]]:e.label,range:ie,usable:!!(o&&l&&o<=l)}}),Ye=e=>{u(null),c(null),D(void 0),P(void 0),v(null),U(e),h(!1)},ze=e=>{e||v(null),h(e)},re=e=>r=>{let o=e==="from"?B:K;r.key==="Enter"&&o!==null?(r.preventDefault(),C(e)):r.key==="ArrowDown"&&r.altKey&&Z&&(r.preventDefault(),C(e),h(!0))},oe=oa[w],We=De??ta(p,d),le=e=>Ge({size:w,error:e,disabled:O,readOnly:E}),se={type:"text",inputMode:"numeric",autoComplete:"off",placeholder:We,disabled:O,readOnly:E,"aria-describedby":Fe.describedBy,"aria-required":H||void 0};return n("div",{className:Ie,children:b(Je,{label:x,hideLabel:be,description:q,helperText:A,error:j??I,required:H,inline:ye,htmlFor:g,children:[b(Xe,{open:Ee,onOpenChange:ze,children:[b("div",{className:"flex w-full items-center gap-2",children:[n("div",{className:"min-w-0 flex-1",children:n("input",{...se,ref:Le,id:g,value:B??(a.from?ce(a.from,p):""),onChange:e=>u(e.target.value),onBlur:()=>{C("from"),G?.()},onKeyDown:re("from"),"aria-labelledby":ee?`${ae} ${T}`:T,"aria-invalid":R||M!==void 0||void 0,className:le(R||M!==void 0)})}),n("span",{"aria-hidden":"true",className:"text-gray-500 dark:text-gray-400",children:"\u2013"}),b("div",{className:"relative min-w-0 flex-1",children:[n("input",{...se,id:Ne,value:K??(a.to?ce(a.to,p):""),onChange:e=>c(e.target.value),onBlur:()=>{C("to"),G?.()},onKeyDown:re("to"),"aria-labelledby":ee?`${ae} ${$}`:$,"aria-invalid":R||F!==void 0||void 0,className:de(le(R||F!==void 0),oe.padding)}),n(je,{asChild:!0,children:n("button",{type:"button",disabled:!Z,"aria-label":d.dateRangePickerOpen,className:ra,children:n(ea,{className:oe.icon})})})]})]}),n("span",{id:T,hidden:!0,children:d.dateRangePickerStart}),n("span",{id:$,hidden:!0,children:d.dateRangePickerEnd}),n(Ze,{side:"bottom",align:"end","aria-label":x||d.dateRangePickerOpen,initialFocus:aa,children:b("div",{className:"-m-4 flex flex-col bg-white sm:flex-row dark:bg-gray-900",children:[ne.length>0?n("div",{role:"group","aria-label":d.dateRangePickerPresets,className:"flex min-w-40 flex-col gap-0.5 border-b border-gray-200 p-2 sm:border-r sm:border-b-0 dark:border-gray-700",children:ne.map(e=>{let r=e.usable&&a.from&&a.to&&k(e.range,a);return n("button",{type:"button",disabled:!e.usable,"aria-pressed":!!r,onClick:()=>Ye(e.range),className:de("cursor-pointer rounded-md px-3 py-1.5 text-left text-sm text-gray-700 hover:bg-gray-100 focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-synertech-primary-500 disabled:cursor-not-allowed disabled:text-gray-400 dark:text-gray-200 dark:hover:bg-gray-800 dark:disabled:text-gray-600",r&&"bg-synertech-primary-50 font-medium text-synertech-primary-700 dark:bg-synertech-primary-950 dark:text-synertech-primary-300"),children:e.caption},e.key)})}):null,n(Qe,{mode:"range",value:Te??a,onChange:Ue,numberOfMonths:ve,minDate:L,maxDate:N,disabledDates:V,weekStartsOn:Pe,locale:p,today:S,captionLayout:Re,fromYear:Ce,toYear:ke,size:w==="sm"?"sm":"md",bordered:!1})]})})]}),_?n("input",{type:"hidden",name:_,value:a.from?z(a.from):""}):null,Q?n("input",{type:"hidden",name:Q,value:a.to?z(a.to):""}):null]})})});da.displayName="DateRangePicker";export{da as DateRangePicker};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";"use client";var s=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var f=(e,t)=>{for(var a in t)s(e,a,{get:t[a],enumerable:!0})},D=(e,t,a,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of m(t))!p.call(e,n)&&n!==a&&s(e,n,{get:()=>t[n],enumerable:!(i=g(t,n))||i.enumerable});return e};var y=e=>D(s({},"__esModule",{value:!0}),e);var b={};f(b,{CalendarIcon:()=>L,calendarTabStop:()=>M,dayOrNull:()=>h,placeholderFor:()=>c,readTypedDate:()=>x,triggerButtonClasses:()=>v,triggerSizeClasses:()=>k});module.exports=y(b);var o=require("../../lib/ui-labels.cjs"),r=require("./date-input.cjs"),l=require("react/jsx-runtime");function c(e,t){return(0,r.datePlaceholder)(e,{day:t.datePickerDayLetters,month:t.datePickerMonthLetters,year:t.datePickerYearLetters})}function u(e,t){return new Intl.DateTimeFormat(t,{day:"numeric",month:"long",year:"numeric"}).format(e)}function x(e,{locale:t,labels:a,today:i,rules:n}){let d=(0,r.parseDateInput)(e,t,i??new Date);if(d===null)return{date:null};if(d==="invalid")return{date:null,message:(0,o.formatUILabel)(a.datePickerInvalid,{format:c(t,a)})};switch((0,r.rejectDate)(d,n)){case"beforeMin":return{date:null,message:(0,o.formatUILabel)(a.datePickerBeforeMin,{date:u(n.minDate,t)})};case"afterMax":return{date:null,message:(0,o.formatUILabel)(a.datePickerAfterMax,{date:u(n.maxDate,t)})};case"unavailable":return{date:null,message:a.datePickerUnavailable};default:return{date:d}}}function h(e){return(0,r.isValidDate)(e)?(0,r.startOfDay)(e):null}var k={sm:{padding:"pr-8",icon:"h-4 w-4"},md:{padding:"pr-10",icon:"h-5 w-5"},lg:{padding:"pr-11",icon:"h-5 w-5"}},v="absolute inset-y-0 right-0 flex cursor-pointer items-center rounded-r-lg px-2.5 text-gray-500 hover:text-gray-700 focus:outline-none focus-visible:ring-2 focus-visible:ring-synertech-primary-500 disabled:cursor-not-allowed disabled:opacity-50 dark:text-gray-400 dark:hover:text-gray-200";function L({className:e}){return(0,l.jsx)("svg",{className:e,viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:(0,l.jsx)("path",{d:"M5 1.5v2M11 1.5v2M2.5 6h11M3.5 3h9a1 1 0 011 1v9a1 1 0 01-1 1h-9a1 1 0 01-1-1V4a1 1 0 011-1z",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})})}function M(e){return e.querySelector('[data-day][tabindex="0"]')}0&&(module.exports={CalendarIcon,calendarTabStop,dayOrNull,placeholderFor,readTypedDate,triggerButtonClasses,triggerSizeClasses});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{formatUILabel as i}from"../../lib/ui-labels.js";import{datePlaceholder as l,isValidDate as u,parseDateInput as c,rejectDate as g,startOfDay as m}from"./date-input.js";import{jsx as o}from"react/jsx-runtime";function p(e,t){return l(e,{day:t.datePickerDayLetters,month:t.datePickerMonthLetters,year:t.datePickerYearLetters})}function d(e,t){return new Intl.DateTimeFormat(t,{day:"numeric",month:"long",year:"numeric"}).format(e)}function y(e,{locale:t,labels:a,today:s,rules:n}){let r=c(e,t,s??new Date);if(r===null)return{date:null};if(r==="invalid")return{date:null,message:i(a.datePickerInvalid,{format:p(t,a)})};switch(g(r,n)){case"beforeMin":return{date:null,message:i(a.datePickerBeforeMin,{date:d(n.minDate,t)})};case"afterMax":return{date:null,message:i(a.datePickerAfterMax,{date:d(n.maxDate,t)})};case"unavailable":return{date:null,message:a.datePickerUnavailable};default:return{date:r}}}function x(e){return u(e)?m(e):null}var h={sm:{padding:"pr-8",icon:"h-4 w-4"},md:{padding:"pr-10",icon:"h-5 w-5"},lg:{padding:"pr-11",icon:"h-5 w-5"}},k="absolute inset-y-0 right-0 flex cursor-pointer items-center rounded-r-lg px-2.5 text-gray-500 hover:text-gray-700 focus:outline-none focus-visible:ring-2 focus-visible:ring-synertech-primary-500 disabled:cursor-not-allowed disabled:opacity-50 dark:text-gray-400 dark:hover:text-gray-200";function v({className:e}){return o("svg",{className:e,viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:o("path",{d:"M5 1.5v2M11 1.5v2M2.5 6h11M3.5 3h9a1 1 0 011 1v9a1 1 0 01-1 1h-9a1 1 0 01-1-1V4a1 1 0 011-1z",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})})}function L(e){return e.querySelector('[data-day][tabindex="0"]')}export{v as CalendarIcon,L as calendarTabStop,x as dayOrNull,p as placeholderFor,y as readTypedDate,k as triggerButtonClasses,h as triggerSizeClasses};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var u=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var M=Object.prototype.hasOwnProperty;var F=(t,e)=>{for(var n in e)u(t,n,{get:e[n],enumerable:!0})},N=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of x(e))!M.call(t,a)&&a!==n&&u(t,a,{get:()=>e[a],enumerable:!(r=b(e,a))||r.enumerable});return t};var P=t=>N(u({},"__esModule",{value:!0}),t);var R={};F(R,{datePattern:()=>f,datePlaceholder:()=>I,formatDateInput:()=>w,isSameDay:()=>g,isValidDate:()=>s,parseDateInput:()=>S,rejectDate:()=>T,startOfDay:()=>l,toISODate:()=>Y});module.exports=P(R);var v={day:"2-digit",month:"2-digit",year:"numeric",numberingSystem:"latn"},D=new Map;function d(t){let e=t??"",n=D.get(e);return n||(n=new Intl.DateTimeFormat(t,v),D.set(e,n)),n}function f(t){let e=d(t).formatToParts(new Date(2026,10,23)),n=e.map(a=>a.type).filter(a=>a==="day"||a==="month"||a==="year"),r=e.find(a=>a.type==="literal")?.value.trim();return{order:n.length===3?n:["year","month","day"],separator:r||"/"}}function w(t,e){return d(e).format(t)}function I(t,e){let{order:n,separator:r}=f(t);return n.map(a=>e[a]).join(r)}function Y(t){let e=`${t.getFullYear()}`.padStart(4,"0"),n=`${t.getMonth()+1}`.padStart(2,"0"),r=`${t.getDate()}`.padStart(2,"0");return`${e}-${n}-${r}`}function l(t){return new Date(t.getFullYear(),t.getMonth(),t.getDate())}function s(t){return t instanceof Date&&!Number.isNaN(t.getTime())}function g(t,e){return!!t&&!!e&&t.getFullYear()===e.getFullYear()&&t.getMonth()===e.getMonth()&&t.getDate()===e.getDate()}function m(t,e,n){if(e<1||e>12||n<1||t<1||t>9999)return null;let r=new Date(2e3,e-1,n);return r.setFullYear(t),r.getMonth()!==e-1||r.getDate()!==n?null:r}function $(t,e){if(t.length===4)return Number(t);if(t.length!==2)return null;let n=Number(t),r=e.getFullYear(),o=Math.floor(r/100)*100+n;return o>r+20?o-100:o}function S(t,e,n=new Date){let r=t.trim();if(r==="")return null;let a=/^(\d{4})-(\d{1,2})-(\d{1,2})$/.exec(r);if(a)return m(Number(a[1]),Number(a[2]),Number(a[3]))??"invalid";let o=r.match(/\d+/g);if(!o||o.length!==3||/[\p{L}]/u.test(r))return"invalid";let{order:p}=f(e),i={};if(p.forEach((y,h)=>{i[y]=o[h]}),!i.day||!i.month||!i.year||i.day.length>2||i.month.length>2)return"invalid";let c=$(i.year,n);return c===null?"invalid":m(c,Number(i.month),Number(i.day))??"invalid"}function T(t,{minDate:e,maxDate:n,disabledDates:r}){return s(e)&&t<l(e)?"beforeMin":s(n)&&t>l(n)?"afterMax":(typeof r=="function"?r(t):r?.some(a=>g(a,t)))?"unavailable":null}0&&(module.exports={datePattern,datePlaceholder,formatDateInput,isSameDay,isValidDate,parseDateInput,rejectDate,startOfDay,toISODate});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var y={day:"2-digit",month:"2-digit",year:"numeric",numberingSystem:"latn"},l=new Map;function D(t){let e=t??"",n=l.get(e);return n||(n=new Intl.DateTimeFormat(t,y),l.set(e,n)),n}function m(t){let e=D(t).formatToParts(new Date(2026,10,23)),n=e.map(a=>a.type).filter(a=>a==="day"||a==="month"||a==="year"),r=e.find(a=>a.type==="literal")?.value.trim();return{order:n.length===3?n:["year","month","day"],separator:r||"/"}}function x(t,e){return D(e).format(t)}function M(t,e){let{order:n,separator:r}=m(t);return n.map(a=>e[a]).join(r)}function F(t){let e=`${t.getFullYear()}`.padStart(4,"0"),n=`${t.getMonth()+1}`.padStart(2,"0"),r=`${t.getDate()}`.padStart(2,"0");return`${e}-${n}-${r}`}function s(t){return new Date(t.getFullYear(),t.getMonth(),t.getDate())}function f(t){return t instanceof Date&&!Number.isNaN(t.getTime())}function h(t,e){return!!t&&!!e&&t.getFullYear()===e.getFullYear()&&t.getMonth()===e.getMonth()&&t.getDate()===e.getDate()}function c(t,e,n){if(e<1||e>12||n<1||t<1||t>9999)return null;let r=new Date(2e3,e-1,n);return r.setFullYear(t),r.getMonth()!==e-1||r.getDate()!==n?null:r}function b(t,e){if(t.length===4)return Number(t);if(t.length!==2)return null;let n=Number(t),r=e.getFullYear(),o=Math.floor(r/100)*100+n;return o>r+20?o-100:o}function N(t,e,n=new Date){let r=t.trim();if(r==="")return null;let a=/^(\d{4})-(\d{1,2})-(\d{1,2})$/.exec(r);if(a)return c(Number(a[1]),Number(a[2]),Number(a[3]))??"invalid";let o=r.match(/\d+/g);if(!o||o.length!==3||/[\p{L}]/u.test(r))return"invalid";let{order:d}=m(e),i={};if(d.forEach((g,p)=>{i[g]=o[p]}),!i.day||!i.month||!i.year||i.day.length>2||i.month.length>2)return"invalid";let u=b(i.year,n);return u===null?"invalid":c(u,Number(i.month),Number(i.day))??"invalid"}function P(t,{minDate:e,maxDate:n,disabledDates:r}){return f(e)&&t<s(e)?"beforeMin":f(n)&&t>s(n)?"afterMax":(typeof r=="function"?r(t):r?.some(a=>h(a,t)))?"unavailable":null}export{m as datePattern,M as datePlaceholder,x as formatDateInput,h as isSameDay,f as isValidDate,N as parseDateInput,P as rejectDate,s as startOfDay,F as toISODate};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var o=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var n=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var g=(r,e)=>{for(var a in e)o(r,a,{get:e[a],enumerable:!0})},k=(r,e,a,P)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of n(e))!c.call(r,t)&&t!==a&&o(r,t,{get:()=>e[t],enumerable:!(P=i(e,t))||P.enumerable});return r};var R=r=>k(o({},"__esModule",{value:!0}),r);var s={};g(s,{DatePicker:()=>p.DatePicker,DateRangePicker:()=>D.DateRangePicker});module.exports=R(s);var p=require("./DatePicker.cjs"),D=require("./DateRangePicker.cjs");0&&(module.exports={DatePicker,DateRangePicker});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{DatePicker as t}from"./DatePicker.js";import{DateRangePicker as o}from"./DateRangePicker.js";export{t as DatePicker,o as DateRangePicker};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";var K=Object.defineProperty;var ve=Object.getOwnPropertyDescriptor;var Fe=Object.getOwnPropertyNames;var we=Object.prototype.hasOwnProperty;var Se=(n,a)=>{for(var f in a)K(n,f,{get:a[f],enumerable:!0})},Ne=(n,a,f,b)=>{if(a&&typeof a=="object"||typeof a=="function")for(let h of Fe(a))!we.call(n,h)&&h!==f&&K(n,h,{get:()=>a[h],enumerable:!(b=ve(a,h))||b.enumerable});return n};var Ie=n=>Ne(K({},"__esModule",{value:!0}),n);var Ae={};Se(Ae,{DIRECTORY_ENTRY_LIMIT:()=>se,FileSelector:()=>Me,readDirectoryEntries:()=>le});module.exports=Ie(Ae);var l=require("react"),p=require("../../lib/cn.cjs"),v=require("../../lib/i18n.cjs"),ie=require("../../lib/accept.cjs"),t=require("react/jsx-runtime"),De={sm:{dropzone:"py-4 px-3",text:"text-xs",subtext:"text-[10px]",icon:"w-6 h-6",button:"px-2.5 py-1.5 text-xs",fileItem:"py-1 px-2 text-xs",gap:"gap-1"},md:{dropzone:"py-6 px-4",text:"text-sm",subtext:"text-xs",icon:"w-8 h-8",button:"px-3 py-2 text-sm",fileItem:"py-1.5 px-3 text-sm",gap:"gap-1.5"},lg:{dropzone:"py-8 px-6",text:"text-base",subtext:"text-sm",icon:"w-10 h-10",button:"px-4 py-2.5 text-base",fileItem:"py-2 px-4 text-base",gap:"gap-2"}},ne=n=>{if(n===0)return"0 B";let a=["B","KB","MB","GB"],f=Math.floor(Math.log(n)/Math.log(1024));return`${(n/Math.pow(1024,f)).toFixed(f===0?0:1)} ${a[f]}`},U=n=>n.webkitRelativePath||n.name,Y=n=>`${U(n)}\0${n.size}\0${n.lastModified}`,Ce=(0,t.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-full h-full",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5m-13.5-9L12 3m0 0l4.5 4.5M12 3v13.5"})}),Ee=(0,t.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-full h-full",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 9.776c.112-.017.227-.026.344-.026h15.812c.117 0 .232.009.344.026m-16.5 0a2.25 2.25 0 00-1.883 2.542l.857 6a2.25 2.25 0 002.227 1.932H19.05a2.25 2.25 0 002.227-1.932l.857-6a2.25 2.25 0 00-1.883-2.542m-16.5 0V6A2.25 2.25 0 016 3.75h3.879a1.5 1.5 0 011.06.44l2.122 2.12a1.5 1.5 0 001.06.44H18A2.25 2.25 0 0120.25 9v.776"})}),Le=0,se=1e4;async function le(n,{keep:a=()=>!0,wanted:f=1/0}={}){let b=[],h=0,y=0,s=()=>h>=f||y>=se,R=async F=>{if(!s()){if(y++,F.isFile){let r=await new Promise((o,w)=>F.file(o,w));b.push(r),a(r)&&h++}else if(F.isDirectory){let r=F.createReader(),o=()=>new Promise((I,k)=>r.readEntries(I,k)),w=await o();for(;w.length>0&&!s();){for(let I of w)await R(I);s()||(w=await o())}}}};for(let F of n)await R(F);return b}function Me({value:n,onChange:a,accept:f,multiple:b=!1,maxSize:h=10*1024*1024,maxFiles:y,mode:s="file",variant:R="dropzone",size:F="md",disabled:r=!1,readOnly:o=!1,label:w,helperText:I,error:k,showFileList:Z=!0,placeholder:q,browseLabel:T,browseFolderLabel:J,labels:ae,icon:ce,onReject:W,className:fe}){let i=(0,v.useUILabels)(ae),[Q,ue]=(0,l.useState)([]),A=(0,l.useRef)(Q),[X,j]=(0,l.useState)(!1),S=(0,l.useRef)(null),$=(0,l.useRef)(null),C=(0,l.useId)(),x=n!==void 0,E=x?n.map((e,g)=>({file:e,id:`ctrl-${g}`})):Q,d=De[F],D=(0,l.useCallback)(e=>{A.current=e,ue(e),a?.(e.map(g=>g.file))},[a]),N=b||s!=="file";(0,l.useEffect)(()=>{s==="directory"&&S.current&&S.current.setAttribute("webkitdirectory",""),s==="both"&&$.current&&$.current.setAttribute("webkitdirectory","")},[s]);let _=(0,l.useMemo)(()=>ne(h),[h]),V=(0,l.useMemo)(()=>f?f.split(",").map(e=>e.trim()).map(e=>e.startsWith(".")?e.toUpperCase():e.endsWith("/*")?e.replace("/*","").toUpperCase():e).join(", "):i.fileSelectorAllFiles,[f,i.fileSelectorAllFiles]),O=s==="directory"?i.fileSelectorDropFolder:s==="both"?i.fileSelectorDropFilesOrFolders:b?i.fileSelectorDropFiles:i.fileSelectorDropFile,pe=s==="directory"?i.fileSelectorBrowseFolder:i.fileSelectorBrowse,de=i.fileSelectorBrowseFolder,ee=(0,v.formatUILabel)(i.fileSelectorTooLarge,{maxSize:_}),te=(0,v.formatUILabel)(i.fileSelectorTypeNotAccepted,{accept:V}),H=(0,l.useCallback)(e=>e.size>h?ee:(0,ie.matchesAccept)(e,f)?null:te,[f,h,ee,te]),B=(0,l.useCallback)(e=>{if(r||o)return;let g=Array.from(e),m=[],P=new Set(N?(x?n??[]:A.current.map(c=>c.file)).map(Y):[]);for(let c of g){let u=H(c);u?W?.(c,u):P.has(Y(c))?W?.(c,i.fileSelectorAlreadyAdded):(N&&P.add(Y(c)),m.push(c))}if(m.length!==0)if(x)if(N){let u=[...n??[],...m],M=y?u.slice(0,y):u;a?.(M)}else a?.([m[0]]);else{let c=m.map(u=>({file:u,id:`file-${++Le}`}));if(N){let u=[...A.current,...c];D(y?u.slice(0,y):u)}else D([c[0]])}},[r,o,x,N,y,n,a,W,H,D,i.fileSelectorAlreadyAdded]),ge=(0,l.useCallback)(e=>{if(!(r||o)){if(x){let g=(n??[]).filter((m,P)=>P!==e);a?.(g)}else D(A.current.filter((g,m)=>m!==e));S.current&&(S.current.value="")}},[r,o,x,n,a,D]),he=(0,l.useCallback)(()=>{r||o||(x?a?.([]):D([]),S.current&&(S.current.value=""))},[r,o,x,a,D]),re=(0,l.useCallback)(e=>{e.target.files&&e.target.files.length>0&&B(e.target.files)},[B]),ye=(0,l.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),!r&&!o&&j(!0)},[r,o]),me=(0,l.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),j(!1)},[]),xe=(0,l.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),j(!1),r||o)return;let g=e.dataTransfer.items;if(g&&g.length>0&&(s==="directory"||s==="both")){let m=[];for(let c=0;c<g.length;c++){let u=g[c].webkitGetAsEntry?.();u&&m.push(u)}if(m.some(c=>c.isDirectory)){let c=x?(n??[]).length:A.current.length,u=y?Math.max(0,y-c):1/0;if(u===0)return;le(m,{keep:M=>H(M)===null,wanted:u}).then(M=>{M.length>0&&B(M)});return}}e.dataTransfer.files&&e.dataTransfer.files.length>0&&B(e.dataTransfer.files)},[r,o,s,B,x,n,y,H]),z=(0,l.useCallback)(()=>{!r&&!o&&S.current?.click()},[r,o]),oe=(0,l.useCallback)(()=>{!r&&!o&&$.current?.click()},[r,o]),L=E.length>0,be=ce||(s==="directory"?Ee:Ce),ke=Z&&L&&(0,t.jsxs)("div",{className:(0,p.cn)("flex flex-col",d.gap),children:[E.map((e,g)=>(0,t.jsxs)("div",{className:(0,p.cn)("flex items-center justify-between rounded-md border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50",d.fileItem),children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[(0,t.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-4 h-4 shrink-0 text-gray-500 dark:text-gray-400",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})}),(0,t.jsx)("span",{className:"truncate text-gray-700 dark:text-gray-300",children:U(e.file)}),(0,t.jsxs)("span",{className:"shrink-0 text-gray-500 dark:text-gray-400",children:["(",ne(e.file.size),")"]})]}),!r&&!o&&(0,t.jsx)("button",{type:"button",onClick:()=>ge(g),className:"shrink-0 ml-2 text-gray-500 hover:text-red-600 dark:text-gray-400 dark:hover:text-red-400 transition-colors cursor-pointer","aria-label":(0,v.formatUILabel)(i.fileSelectorRemove,{name:U(e.file)}),children:(0,t.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-4 h-4",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]},e.id)),N&&E.length>1&&!r&&!o&&(0,t.jsx)("button",{type:"button",onClick:he,className:(0,p.cn)("self-start text-gray-500 hover:text-red-600 dark:text-gray-400 dark:hover:text-red-400 transition-colors cursor-pointer",d.subtext),children:i.fileSelectorRemoveAll})]}),G=(0,p.cn)("rounded-md border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-200 font-medium transition-colors","hover:bg-gray-50 dark:hover:bg-gray-700","disabled:opacity-50 disabled:cursor-not-allowed cursor-pointer","focus:outline-none focus:ring-2 focus:ring-synertech-primary-500 focus:ring-offset-1",d.button,k&&"border-red-300 dark:border-red-600");return(0,t.jsxs)("div",{className:(0,p.cn)("flex flex-col",d.gap,fe),children:[w&&(0,t.jsx)("label",{htmlFor:C,className:(0,p.cn)("block font-medium text-gray-700 dark:text-gray-300",d.text),children:w}),(0,t.jsx)("input",{ref:S,id:C,type:"file",accept:s!=="directory"?f:void 0,multiple:N,onChange:re,className:"sr-only",tabIndex:-1,disabled:r||o,"aria-describedby":k?`${C}-error`:I?`${C}-helper`:void 0,"aria-invalid":!!k}),s==="both"&&(0,t.jsx)("input",{ref:$,type:"file",onChange:re,className:"sr-only",disabled:r||o,tabIndex:-1,"aria-hidden":"true"}),R==="dropzone"?(0,t.jsxs)("div",{role:s==="both"?"group":"button",tabIndex:s==="both"?void 0:r||o?-1:0,onClick:s==="both"?void 0:z,onKeyDown:s==="both"?void 0:e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),z())},onDragOver:ye,onDragLeave:me,onDrop:xe,className:(0,p.cn)("flex flex-col items-center justify-center rounded-lg border-2 border-dashed transition-colors",d.dropzone,X&&!r&&!o?"border-synertech-primary-500 bg-synertech-primary-50 dark:bg-synertech-primary-900/20":"border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800",!r&&!o&&"hover:border-synertech-primary-400 dark:hover:border-synertech-primary-500 hover:bg-gray-50 dark:hover:bg-gray-800/70",s!=="both"&&!r&&!o&&"cursor-pointer",r&&"opacity-50 cursor-not-allowed",o&&"cursor-default",k&&"border-red-300 dark:border-red-600"),"aria-label":s==="both"?i.fileSelectorDropZone:q||O,children:[(0,t.jsx)("div",{className:(0,p.cn)("text-gray-500 dark:text-gray-400 mb-2",d.icon,X&&"text-synertech-primary-600 dark:text-synertech-primary-400"),children:be}),(0,t.jsxs)("p",{className:(0,p.cn)("text-gray-600 dark:text-gray-400",d.text),children:[q||O," ",!r&&!o&&s!=="both"&&(0,t.jsx)("span",{className:"text-synertech-primary-600 dark:text-synertech-primary-400 font-medium",children:T||pe})]}),s==="both"&&!r&&!o&&(0,t.jsxs)("div",{className:(0,p.cn)("flex items-center gap-3 mt-1",d.text),children:[(0,t.jsx)("button",{type:"button",onClick:z,className:"text-synertech-primary-600 dark:text-synertech-primary-400 font-medium hover:underline cursor-pointer focus:outline-none focus:ring-2 focus:ring-synertech-primary-500 focus:ring-offset-1 rounded",children:T||i.fileSelectorBrowseFiles}),(0,t.jsx)("span",{className:"text-gray-500 dark:text-gray-400",children:"\xB7"}),(0,t.jsx)("button",{type:"button",onClick:oe,className:"text-synertech-primary-600 dark:text-synertech-primary-400 font-medium hover:underline cursor-pointer focus:outline-none focus:ring-2 focus:ring-synertech-primary-500 focus:ring-offset-1 rounded",children:J||de})]}),(0,t.jsx)("p",{className:(0,p.cn)("text-gray-500 dark:text-gray-400 mt-1",d.subtext),children:N&&y?(0,v.formatUILabel)(i.fileSelectorConstraintsMaxFiles,{accept:V,maxSize:_,maxFiles:y}):(0,v.formatUILabel)(i.fileSelectorConstraints,{accept:V,maxSize:_})})]}):(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[s==="both"?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("button",{type:"button",onClick:z,disabled:r||o,className:G,children:T||(L?i.fileSelectorChangeFiles:i.fileSelectorChooseFiles)}),(0,t.jsx)("button",{type:"button",onClick:oe,disabled:r||o,className:G,children:J||i.fileSelectorChooseFolder})]}):(0,t.jsx)("button",{type:"button",onClick:z,disabled:r||o,className:G,children:T||(s==="directory"?L?i.fileSelectorChangeFolder:i.fileSelectorChooseFolder:L?i.fileSelectorChangeFile:i.fileSelectorChooseFile)}),!L&&(0,t.jsx)("span",{className:(0,p.cn)("text-gray-500 dark:text-gray-400",d.text),children:s==="directory"?i.fileSelectorNoFolder:s==="both"?i.fileSelectorNoFileOrFolder:i.fileSelectorNoFile}),L&&!Z&&(0,t.jsx)("span",{className:(0,p.cn)("text-gray-600 dark:text-gray-400 truncate",d.text),children:E.length===1?U(E[0].file):(0,v.formatUILabel)(i.fileSelectorFilesSelected,{count:E.length})})]}),ke,k&&(0,t.jsx)("p",{id:`${C}-error`,className:(0,p.cn)("text-red-600 dark:text-red-400",d.subtext),role:"alert",children:k}),I&&!k&&(0,t.jsx)("p",{id:`${C}-helper`,className:(0,p.cn)("text-gray-500 dark:text-gray-400",d.subtext),children:I})]})}0&&(module.exports={DIRECTORY_ENTRY_LIMIT,FileSelector,readDirectoryEntries});
|
|
1
|
+
"use strict";"use client";var Y=Object.defineProperty;var we=Object.getOwnPropertyDescriptor;var Se=Object.getOwnPropertyNames;var Ne=Object.prototype.hasOwnProperty;var Ie=(i,a)=>{for(var f in a)Y(i,f,{get:a[f],enumerable:!0})},De=(i,a,f,v)=>{if(a&&typeof a=="object"||typeof a=="function")for(let y of Se(a))!Ne.call(i,y)&&y!==f&&Y(i,y,{get:()=>a[y],enumerable:!(v=we(a,y))||v.enumerable});return i};var Ce=i=>De(Y({},"__esModule",{value:!0}),i);var ze={};Ie(ze,{DIRECTORY_ENTRY_LIMIT:()=>ae,FileSelector:()=>Ae,readDirectoryEntries:()=>ce});module.exports=Ce(ze);var l=require("react"),u=require("../../lib/cn.cjs"),k=require("../../lib/i18n.cjs"),ne=require("../../lib/accept.cjs"),le=require("../form/shared/field-error.cjs"),t=require("react/jsx-runtime"),Ee={sm:{dropzone:"py-4 px-3",text:"text-xs",subtext:"text-[10px]",icon:"w-6 h-6",button:"px-2.5 py-1.5 text-xs",fileItem:"py-1 px-2 text-xs",gap:"gap-1"},md:{dropzone:"py-6 px-4",text:"text-sm",subtext:"text-xs",icon:"w-8 h-8",button:"px-3 py-2 text-sm",fileItem:"py-1.5 px-3 text-sm",gap:"gap-1.5"},lg:{dropzone:"py-8 px-6",text:"text-base",subtext:"text-sm",icon:"w-10 h-10",button:"px-4 py-2.5 text-base",fileItem:"py-2 px-4 text-base",gap:"gap-2"}},se=i=>{if(i===0)return"0 B";let a=["B","KB","MB","GB"],f=Math.floor(Math.log(i)/Math.log(1024));return`${(i/Math.pow(1024,f)).toFixed(f===0?0:1)} ${a[f]}`},$=i=>i.webkitRelativePath||i.name,Z=i=>`${$(i)}\0${i.size}\0${i.lastModified}`,Le=(0,t.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-full h-full",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5m-13.5-9L12 3m0 0l4.5 4.5M12 3v13.5"})}),Be=(0,t.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-full h-full",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 9.776c.112-.017.227-.026.344-.026h15.812c.117 0 .232.009.344.026m-16.5 0a2.25 2.25 0 00-1.883 2.542l.857 6a2.25 2.25 0 002.227 1.932H19.05a2.25 2.25 0 002.227-1.932l.857-6a2.25 2.25 0 00-1.883-2.542m-16.5 0V6A2.25 2.25 0 016 3.75h3.879a1.5 1.5 0 011.06.44l2.122 2.12a1.5 1.5 0 001.06.44H18A2.25 2.25 0 0120.25 9v.776"})}),Me=0,ae=1e4;async function ce(i,{keep:a=()=>!0,wanted:f=1/0}={}){let v=[],y=0,m=0,n=()=>y>=f||m>=ae,T=async F=>{if(!n()){if(m++,F.isFile){let r=await new Promise((o,w)=>F.file(o,w));v.push(r),a(r)&&y++}else if(F.isDirectory){let r=F.createReader(),o=()=>new Promise((D,U)=>r.readEntries(D,U)),w=await o();for(;w.length>0&&!n();){for(let D of w)await T(D);n()||(w=await o())}}}};for(let F of i)await T(F);return v}function Ae({value:i,onChange:a,accept:f,multiple:v=!1,maxSize:y=10*1024*1024,maxFiles:m,mode:n="file",variant:T="dropzone",size:F="md",disabled:r=!1,readOnly:o=!1,label:w,helperText:D,error:U,showFileList:q=!0,placeholder:J,browseLabel:P,browseFolderLabel:Q,labels:fe,icon:de,onReject:W,className:ue}){let s=(0,k.useUILabels)(fe),[X,pe]=(0,l.useState)([]),B=(0,l.useRef)(X),[O,j]=(0,l.useState)(!1),S=(0,l.useRef)(null),R=(0,l.useRef)(null),_=(0,l.useId)(),h=(0,le.describeField)(_,{helperText:D,error:U}),x=i!==void 0,C=x?i.map((e,g)=>({file:e,id:`ctrl-${g}`})):X,p=Ee[F],I=(0,l.useCallback)(e=>{B.current=e,pe(e),a?.(e.map(g=>g.file))},[a]),N=v||n!=="file";(0,l.useEffect)(()=>{n==="directory"&&S.current&&S.current.setAttribute("webkitdirectory",""),n==="both"&&R.current&&R.current.setAttribute("webkitdirectory","")},[n]);let V=(0,l.useMemo)(()=>se(y),[y]),G=(0,l.useMemo)(()=>f?f.split(",").map(e=>e.trim()).map(e=>e.startsWith(".")?e.toUpperCase():e.endsWith("/*")?e.replace("/*","").toUpperCase():e).join(", "):s.fileSelectorAllFiles,[f,s.fileSelectorAllFiles]),ee=n==="directory"?s.fileSelectorDropFolder:n==="both"?s.fileSelectorDropFilesOrFolders:v?s.fileSelectorDropFiles:s.fileSelectorDropFile,ge=n==="directory"?s.fileSelectorBrowseFolder:s.fileSelectorBrowse,he=s.fileSelectorBrowseFolder,te=(0,k.formatUILabel)(s.fileSelectorTooLarge,{maxSize:V}),re=(0,k.formatUILabel)(s.fileSelectorTypeNotAccepted,{accept:G}),H=(0,l.useCallback)(e=>e.size>y?te:(0,ne.matchesAccept)(e,f)?null:re,[f,y,te,re]),M=(0,l.useCallback)(e=>{if(r||o)return;let g=Array.from(e),b=[],z=new Set(N?(x?i??[]:B.current.map(c=>c.file)).map(Z):[]);for(let c of g){let d=H(c);d?W?.(c,d):z.has(Z(c))?W?.(c,s.fileSelectorAlreadyAdded):(N&&z.add(Z(c)),b.push(c))}if(b.length!==0)if(x)if(N){let d=[...i??[],...b],L=m?d.slice(0,m):d;a?.(L)}else a?.([b[0]]);else{let c=b.map(d=>({file:d,id:`file-${++Me}`}));if(N){let d=[...B.current,...c];I(m?d.slice(0,m):d)}else I([c[0]])}},[r,o,x,N,m,i,a,W,H,I,s.fileSelectorAlreadyAdded]),ye=(0,l.useCallback)(e=>{if(!(r||o)){if(x){let g=(i??[]).filter((b,z)=>z!==e);a?.(g)}else I(B.current.filter((g,b)=>b!==e));S.current&&(S.current.value="")}},[r,o,x,i,a,I]),me=(0,l.useCallback)(()=>{r||o||(x?a?.([]):I([]),S.current&&(S.current.value=""))},[r,o,x,a,I]),oe=(0,l.useCallback)(e=>{e.target.files&&e.target.files.length>0&&M(e.target.files)},[M]),be=(0,l.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),!r&&!o&&j(!0)},[r,o]),xe=(0,l.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),j(!1)},[]),ve=(0,l.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),j(!1),r||o)return;let g=e.dataTransfer.items;if(g&&g.length>0&&(n==="directory"||n==="both")){let b=[];for(let c=0;c<g.length;c++){let d=g[c].webkitGetAsEntry?.();d&&b.push(d)}if(b.some(c=>c.isDirectory)){let c=x?(i??[]).length:B.current.length,d=m?Math.max(0,m-c):1/0;if(d===0)return;ce(b,{keep:L=>H(L)===null,wanted:d}).then(L=>{L.length>0&&M(L)});return}}e.dataTransfer.files&&e.dataTransfer.files.length>0&&M(e.dataTransfer.files)},[r,o,n,M,x,i,m,H]),A=(0,l.useCallback)(()=>{!r&&!o&&S.current?.click()},[r,o]),ie=(0,l.useCallback)(()=>{!r&&!o&&R.current?.click()},[r,o]),E=C.length>0,ke=de||(n==="directory"?Be:Le),Fe=q&&E&&(0,t.jsxs)("div",{className:(0,u.cn)("flex flex-col",p.gap),children:[C.map((e,g)=>(0,t.jsxs)("div",{className:(0,u.cn)("flex items-center justify-between rounded-md border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50",p.fileItem),children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[(0,t.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-4 h-4 shrink-0 text-gray-500 dark:text-gray-400",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})}),(0,t.jsx)("span",{className:"truncate text-gray-700 dark:text-gray-300",children:$(e.file)}),(0,t.jsxs)("span",{className:"shrink-0 text-gray-500 dark:text-gray-400",children:["(",se(e.file.size),")"]})]}),!r&&!o&&(0,t.jsx)("button",{type:"button",onClick:()=>ye(g),className:"shrink-0 ml-2 text-gray-500 hover:text-red-600 dark:text-gray-400 dark:hover:text-red-400 transition-colors cursor-pointer","aria-label":(0,k.formatUILabel)(s.fileSelectorRemove,{name:$(e.file)}),children:(0,t.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-4 h-4",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]},e.id)),N&&C.length>1&&!r&&!o&&(0,t.jsx)("button",{type:"button",onClick:me,className:(0,u.cn)("self-start text-gray-500 hover:text-red-600 dark:text-gray-400 dark:hover:text-red-400 transition-colors cursor-pointer",p.subtext),children:s.fileSelectorRemoveAll})]}),K=(0,u.cn)("rounded-md border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-200 font-medium transition-colors","hover:bg-gray-50 dark:hover:bg-gray-700","disabled:opacity-50 disabled:cursor-not-allowed cursor-pointer","focus:outline-none focus:ring-2 focus:ring-synertech-primary-500 focus:ring-offset-1",p.button,h.invalid&&"border-red-500 dark:border-red-500");return(0,t.jsxs)("div",{className:(0,u.cn)("flex flex-col",p.gap,ue),children:[w&&(0,t.jsx)("label",{htmlFor:_,className:(0,u.cn)("block font-medium text-gray-700 dark:text-gray-300",p.text),children:w}),(0,t.jsx)("input",{ref:S,id:_,type:"file",accept:n!=="directory"?f:void 0,multiple:N,onChange:oe,className:"sr-only",tabIndex:-1,disabled:r||o,"aria-describedby":h.describedBy,"aria-invalid":h.invalid||void 0}),n==="both"&&(0,t.jsx)("input",{ref:R,type:"file",onChange:oe,className:"sr-only",disabled:r||o,tabIndex:-1,"aria-hidden":"true"}),T==="dropzone"?(0,t.jsxs)("div",{role:n==="both"?"group":"button",tabIndex:n==="both"?void 0:r||o?-1:0,onClick:n==="both"?void 0:A,onKeyDown:n==="both"?void 0:e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),A())},onDragOver:be,onDragLeave:xe,onDrop:ve,className:(0,u.cn)("flex flex-col items-center justify-center rounded-lg border-2 border-dashed transition-colors",p.dropzone,O&&!r&&!o?"border-synertech-primary-500 bg-synertech-primary-50 dark:bg-synertech-primary-900/20":"border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800",!r&&!o&&"hover:border-synertech-primary-400 dark:hover:border-synertech-primary-500 hover:bg-gray-50 dark:hover:bg-gray-800/70",n!=="both"&&!r&&!o&&"cursor-pointer",r&&"opacity-50 cursor-not-allowed",o&&"cursor-default",h.invalid&&"border-red-500 dark:border-red-500"),"aria-label":n==="both"?s.fileSelectorDropZone:J||ee,"aria-describedby":h.describedBy,children:[(0,t.jsx)("div",{className:(0,u.cn)("text-gray-500 dark:text-gray-400 mb-2",p.icon,O&&"text-synertech-primary-600 dark:text-synertech-primary-400"),children:ke}),(0,t.jsxs)("p",{className:(0,u.cn)("text-gray-600 dark:text-gray-400",p.text),children:[J||ee," ",!r&&!o&&n!=="both"&&(0,t.jsx)("span",{className:"text-synertech-primary-600 dark:text-synertech-primary-400 font-medium",children:P||ge})]}),n==="both"&&!r&&!o&&(0,t.jsxs)("div",{className:(0,u.cn)("flex items-center gap-3 mt-1",p.text),children:[(0,t.jsx)("button",{type:"button",onClick:A,className:"text-synertech-primary-600 dark:text-synertech-primary-400 font-medium hover:underline cursor-pointer focus:outline-none focus:ring-2 focus:ring-synertech-primary-500 focus:ring-offset-1 rounded",children:P||s.fileSelectorBrowseFiles}),(0,t.jsx)("span",{className:"text-gray-500 dark:text-gray-400",children:"\xB7"}),(0,t.jsx)("button",{type:"button",onClick:ie,className:"text-synertech-primary-600 dark:text-synertech-primary-400 font-medium hover:underline cursor-pointer focus:outline-none focus:ring-2 focus:ring-synertech-primary-500 focus:ring-offset-1 rounded",children:Q||he})]}),(0,t.jsx)("p",{className:(0,u.cn)("text-gray-500 dark:text-gray-400 mt-1",p.subtext),children:N&&m?(0,k.formatUILabel)(s.fileSelectorConstraintsMaxFiles,{accept:G,maxSize:V,maxFiles:m}):(0,k.formatUILabel)(s.fileSelectorConstraints,{accept:G,maxSize:V})})]}):(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[n==="both"?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("button",{type:"button",onClick:A,disabled:r||o,className:K,"aria-describedby":h.describedBy,children:P||(E?s.fileSelectorChangeFiles:s.fileSelectorChooseFiles)}),(0,t.jsx)("button",{type:"button",onClick:ie,disabled:r||o,className:K,"aria-describedby":h.describedBy,children:Q||s.fileSelectorChooseFolder})]}):(0,t.jsx)("button",{type:"button",onClick:A,disabled:r||o,className:K,"aria-describedby":h.describedBy,children:P||(n==="directory"?E?s.fileSelectorChangeFolder:s.fileSelectorChooseFolder:E?s.fileSelectorChangeFile:s.fileSelectorChooseFile)}),!E&&(0,t.jsx)("span",{className:(0,u.cn)("text-gray-500 dark:text-gray-400",p.text),children:n==="directory"?s.fileSelectorNoFolder:n==="both"?s.fileSelectorNoFileOrFolder:s.fileSelectorNoFile}),E&&!q&&(0,t.jsx)("span",{className:(0,u.cn)("text-gray-600 dark:text-gray-400 truncate",p.text),children:C.length===1?$(C[0].file):(0,k.formatUILabel)(s.fileSelectorFilesSelected,{count:C.length})})]}),Fe,h.message!==void 0&&(0,t.jsx)("p",{id:h.ids.error,className:(0,u.cn)("text-red-600 dark:text-red-400",p.subtext),children:h.message}),h.showHelper&&(0,t.jsx)("p",{id:h.ids.helper,className:(0,u.cn)(h.invalid?"text-red-600 dark:text-red-400":"text-gray-500 dark:text-gray-400",p.subtext),children:D})]})}0&&(module.exports={DIRECTORY_ENTRY_LIMIT,FileSelector,readDirectoryEntries});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useState as ie,useRef as Y,useCallback as y,useEffect as ve,useMemo as se,useId as Fe}from"react";import{cn as u}from"../../lib/cn.js";import{formatUILabel as A,useUILabels as we}from"../../lib/i18n.js";import{matchesAccept as Se}from"../../lib/accept.js";import{Fragment as Me,jsx as i,jsxs as x}from"react/jsx-runtime";var Ne={sm:{dropzone:"py-4 px-3",text:"text-xs",subtext:"text-[10px]",icon:"w-6 h-6",button:"px-2.5 py-1.5 text-xs",fileItem:"py-1 px-2 text-xs",gap:"gap-1"},md:{dropzone:"py-6 px-4",text:"text-sm",subtext:"text-xs",icon:"w-8 h-8",button:"px-3 py-2 text-sm",fileItem:"py-1.5 px-3 text-sm",gap:"gap-1.5"},lg:{dropzone:"py-8 px-6",text:"text-base",subtext:"text-sm",icon:"w-10 h-10",button:"px-4 py-2.5 text-base",fileItem:"py-2 px-4 text-base",gap:"gap-2"}},le=s=>{if(s===0)return"0 B";let p=["B","KB","MB","GB"],g=Math.floor(Math.log(s)/Math.log(1024));return`${(s/Math.pow(1024,g)).toFixed(g===0?0:1)} ${p[g]}`},W=s=>s.webkitRelativePath||s.name,Z=s=>`${W(s)}\0${s.size}\0${s.lastModified}`,Ie=i("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-full h-full",children:i("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5m-13.5-9L12 3m0 0l4.5 4.5M12 3v13.5"})}),De=i("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-full h-full",children:i("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 9.776c.112-.017.227-.026.344-.026h15.812c.117 0 .232.009.344.026m-16.5 0a2.25 2.25 0 00-1.883 2.542l.857 6a2.25 2.25 0 002.227 1.932H19.05a2.25 2.25 0 002.227-1.932l.857-6a2.25 2.25 0 00-1.883-2.542m-16.5 0V6A2.25 2.25 0 016 3.75h3.879a1.5 1.5 0 011.06.44l2.122 2.12a1.5 1.5 0 001.06.44H18A2.25 2.25 0 0120.25 9v.776"})}),Ce=0,Ee=1e4;async function Le(s,{keep:p=()=>!0,wanted:g=1/0}={}){let D=[],S=0,d=0,n=()=>S>=g||d>=Ee,T=async k=>{if(!n()){if(d++,k.isFile){let t=await new Promise((r,v)=>k.file(r,v));D.push(t),p(t)&&S++}else if(k.isDirectory){let t=k.createReader(),r=()=>new Promise((N,b)=>t.readEntries(N,b)),v=await r();for(;v.length>0&&!n();){for(let N of v)await T(N);n()||(v=await r())}}}};for(let k of s)await T(k);return D}function Re({value:s,onChange:p,accept:g,multiple:D=!1,maxSize:S=10*1024*1024,maxFiles:d,mode:n="file",variant:T="dropzone",size:k="md",disabled:t=!1,readOnly:r=!1,label:v,helperText:N,error:b,showFileList:q=!0,placeholder:J,browseLabel:$,browseFolderLabel:Q,labels:ae,icon:ce,onReject:j,className:fe}){let o=we(ae),[X,ue]=ie([]),B=Y(X),[O,_]=ie(!1),F=Y(null),H=Y(null),C=Fe(),m=s!==void 0,E=m?s.map((e,f)=>({file:e,id:`ctrl-${f}`})):X,c=Ne[k],I=y(e=>{B.current=e,ue(e),p?.(e.map(f=>f.file))},[p]),w=D||n!=="file";ve(()=>{n==="directory"&&F.current&&F.current.setAttribute("webkitdirectory",""),n==="both"&&H.current&&H.current.setAttribute("webkitdirectory","")},[n]);let V=se(()=>le(S),[S]),G=se(()=>g?g.split(",").map(e=>e.trim()).map(e=>e.startsWith(".")?e.toUpperCase():e.endsWith("/*")?e.replace("/*","").toUpperCase():e).join(", "):o.fileSelectorAllFiles,[g,o.fileSelectorAllFiles]),ee=n==="directory"?o.fileSelectorDropFolder:n==="both"?o.fileSelectorDropFilesOrFolders:D?o.fileSelectorDropFiles:o.fileSelectorDropFile,pe=n==="directory"?o.fileSelectorBrowseFolder:o.fileSelectorBrowse,de=o.fileSelectorBrowseFolder,te=A(o.fileSelectorTooLarge,{maxSize:V}),re=A(o.fileSelectorTypeNotAccepted,{accept:G}),U=y(e=>e.size>S?te:Se(e,g)?null:re,[g,S,te,re]),z=y(e=>{if(t||r)return;let f=Array.from(e),h=[],R=new Set(w?(m?s??[]:B.current.map(l=>l.file)).map(Z):[]);for(let l of f){let a=U(l);a?j?.(l,a):R.has(Z(l))?j?.(l,o.fileSelectorAlreadyAdded):(w&&R.add(Z(l)),h.push(l))}if(h.length!==0)if(m)if(w){let a=[...s??[],...h],M=d?a.slice(0,d):a;p?.(M)}else p?.([h[0]]);else{let l=h.map(a=>({file:a,id:`file-${++Ce}`}));if(w){let a=[...B.current,...l];I(d?a.slice(0,d):a)}else I([l[0]])}},[t,r,m,w,d,s,p,j,U,I,o.fileSelectorAlreadyAdded]),ge=y(e=>{if(!(t||r)){if(m){let f=(s??[]).filter((h,R)=>R!==e);p?.(f)}else I(B.current.filter((f,h)=>h!==e));F.current&&(F.current.value="")}},[t,r,m,s,p,I]),he=y(()=>{t||r||(m?p?.([]):I([]),F.current&&(F.current.value=""))},[t,r,m,p,I]),oe=y(e=>{e.target.files&&e.target.files.length>0&&z(e.target.files)},[z]),ye=y(e=>{e.preventDefault(),e.stopPropagation(),!t&&!r&&_(!0)},[t,r]),me=y(e=>{e.preventDefault(),e.stopPropagation(),_(!1)},[]),xe=y(e=>{if(e.preventDefault(),e.stopPropagation(),_(!1),t||r)return;let f=e.dataTransfer.items;if(f&&f.length>0&&(n==="directory"||n==="both")){let h=[];for(let l=0;l<f.length;l++){let a=f[l].webkitGetAsEntry?.();a&&h.push(a)}if(h.some(l=>l.isDirectory)){let l=m?(s??[]).length:B.current.length,a=d?Math.max(0,d-l):1/0;if(a===0)return;Le(h,{keep:M=>U(M)===null,wanted:a}).then(M=>{M.length>0&&z(M)});return}}e.dataTransfer.files&&e.dataTransfer.files.length>0&&z(e.dataTransfer.files)},[t,r,n,z,m,s,d,U]),P=y(()=>{!t&&!r&&F.current?.click()},[t,r]),ne=y(()=>{!t&&!r&&H.current?.click()},[t,r]),L=E.length>0,be=ce||(n==="directory"?De:Ie),ke=q&&L&&x("div",{className:u("flex flex-col",c.gap),children:[E.map((e,f)=>x("div",{className:u("flex items-center justify-between rounded-md border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50",c.fileItem),children:[x("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[i("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-4 h-4 shrink-0 text-gray-500 dark:text-gray-400",children:i("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})}),i("span",{className:"truncate text-gray-700 dark:text-gray-300",children:W(e.file)}),x("span",{className:"shrink-0 text-gray-500 dark:text-gray-400",children:["(",le(e.file.size),")"]})]}),!t&&!r&&i("button",{type:"button",onClick:()=>ge(f),className:"shrink-0 ml-2 text-gray-500 hover:text-red-600 dark:text-gray-400 dark:hover:text-red-400 transition-colors cursor-pointer","aria-label":A(o.fileSelectorRemove,{name:W(e.file)}),children:i("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-4 h-4",children:i("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]},e.id)),w&&E.length>1&&!t&&!r&&i("button",{type:"button",onClick:he,className:u("self-start text-gray-500 hover:text-red-600 dark:text-gray-400 dark:hover:text-red-400 transition-colors cursor-pointer",c.subtext),children:o.fileSelectorRemoveAll})]}),K=u("rounded-md border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-200 font-medium transition-colors","hover:bg-gray-50 dark:hover:bg-gray-700","disabled:opacity-50 disabled:cursor-not-allowed cursor-pointer","focus:outline-none focus:ring-2 focus:ring-synertech-primary-500 focus:ring-offset-1",c.button,b&&"border-red-300 dark:border-red-600");return x("div",{className:u("flex flex-col",c.gap,fe),children:[v&&i("label",{htmlFor:C,className:u("block font-medium text-gray-700 dark:text-gray-300",c.text),children:v}),i("input",{ref:F,id:C,type:"file",accept:n!=="directory"?g:void 0,multiple:w,onChange:oe,className:"sr-only",tabIndex:-1,disabled:t||r,"aria-describedby":b?`${C}-error`:N?`${C}-helper`:void 0,"aria-invalid":!!b}),n==="both"&&i("input",{ref:H,type:"file",onChange:oe,className:"sr-only",disabled:t||r,tabIndex:-1,"aria-hidden":"true"}),T==="dropzone"?x("div",{role:n==="both"?"group":"button",tabIndex:n==="both"?void 0:t||r?-1:0,onClick:n==="both"?void 0:P,onKeyDown:n==="both"?void 0:e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),P())},onDragOver:ye,onDragLeave:me,onDrop:xe,className:u("flex flex-col items-center justify-center rounded-lg border-2 border-dashed transition-colors",c.dropzone,O&&!t&&!r?"border-synertech-primary-500 bg-synertech-primary-50 dark:bg-synertech-primary-900/20":"border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800",!t&&!r&&"hover:border-synertech-primary-400 dark:hover:border-synertech-primary-500 hover:bg-gray-50 dark:hover:bg-gray-800/70",n!=="both"&&!t&&!r&&"cursor-pointer",t&&"opacity-50 cursor-not-allowed",r&&"cursor-default",b&&"border-red-300 dark:border-red-600"),"aria-label":n==="both"?o.fileSelectorDropZone:J||ee,children:[i("div",{className:u("text-gray-500 dark:text-gray-400 mb-2",c.icon,O&&"text-synertech-primary-600 dark:text-synertech-primary-400"),children:be}),x("p",{className:u("text-gray-600 dark:text-gray-400",c.text),children:[J||ee," ",!t&&!r&&n!=="both"&&i("span",{className:"text-synertech-primary-600 dark:text-synertech-primary-400 font-medium",children:$||pe})]}),n==="both"&&!t&&!r&&x("div",{className:u("flex items-center gap-3 mt-1",c.text),children:[i("button",{type:"button",onClick:P,className:"text-synertech-primary-600 dark:text-synertech-primary-400 font-medium hover:underline cursor-pointer focus:outline-none focus:ring-2 focus:ring-synertech-primary-500 focus:ring-offset-1 rounded",children:$||o.fileSelectorBrowseFiles}),i("span",{className:"text-gray-500 dark:text-gray-400",children:"\xB7"}),i("button",{type:"button",onClick:ne,className:"text-synertech-primary-600 dark:text-synertech-primary-400 font-medium hover:underline cursor-pointer focus:outline-none focus:ring-2 focus:ring-synertech-primary-500 focus:ring-offset-1 rounded",children:Q||de})]}),i("p",{className:u("text-gray-500 dark:text-gray-400 mt-1",c.subtext),children:w&&d?A(o.fileSelectorConstraintsMaxFiles,{accept:G,maxSize:V,maxFiles:d}):A(o.fileSelectorConstraints,{accept:G,maxSize:V})})]}):x("div",{className:"flex items-center gap-2",children:[n==="both"?x(Me,{children:[i("button",{type:"button",onClick:P,disabled:t||r,className:K,children:$||(L?o.fileSelectorChangeFiles:o.fileSelectorChooseFiles)}),i("button",{type:"button",onClick:ne,disabled:t||r,className:K,children:Q||o.fileSelectorChooseFolder})]}):i("button",{type:"button",onClick:P,disabled:t||r,className:K,children:$||(n==="directory"?L?o.fileSelectorChangeFolder:o.fileSelectorChooseFolder:L?o.fileSelectorChangeFile:o.fileSelectorChooseFile)}),!L&&i("span",{className:u("text-gray-500 dark:text-gray-400",c.text),children:n==="directory"?o.fileSelectorNoFolder:n==="both"?o.fileSelectorNoFileOrFolder:o.fileSelectorNoFile}),L&&!q&&i("span",{className:u("text-gray-600 dark:text-gray-400 truncate",c.text),children:E.length===1?W(E[0].file):A(o.fileSelectorFilesSelected,{count:E.length})})]}),ke,b&&i("p",{id:`${C}-error`,className:u("text-red-600 dark:text-red-400",c.subtext),role:"alert",children:b}),N&&!b&&i("p",{id:`${C}-helper`,className:u("text-gray-500 dark:text-gray-400",c.subtext),children:N})]})}export{Ee as DIRECTORY_ENTRY_LIMIT,Re as FileSelector,Le as readDirectoryEntries};
|
|
1
|
+
"use client";import{useState as ne,useRef as Z,useCallback as m,useEffect as Fe,useMemo as le,useId as we}from"react";import{cn as d}from"../../lib/cn.js";import{formatUILabel as B,useUILabels as Se}from"../../lib/i18n.js";import{matchesAccept as Ne}from"../../lib/accept.js";import{describeField as Ie}from"../form/shared/field-error.js";import{Fragment as Ae,jsx as s,jsxs as x}from"react/jsx-runtime";var De={sm:{dropzone:"py-4 px-3",text:"text-xs",subtext:"text-[10px]",icon:"w-6 h-6",button:"px-2.5 py-1.5 text-xs",fileItem:"py-1 px-2 text-xs",gap:"gap-1"},md:{dropzone:"py-6 px-4",text:"text-sm",subtext:"text-xs",icon:"w-8 h-8",button:"px-3 py-2 text-sm",fileItem:"py-1.5 px-3 text-sm",gap:"gap-1.5"},lg:{dropzone:"py-8 px-6",text:"text-base",subtext:"text-sm",icon:"w-10 h-10",button:"px-4 py-2.5 text-base",fileItem:"py-2 px-4 text-base",gap:"gap-2"}},ae=n=>{if(n===0)return"0 B";let p=["B","KB","MB","GB"],h=Math.floor(Math.log(n)/Math.log(1024));return`${(n/Math.pow(1024,h)).toFixed(h===0?0:1)} ${p[h]}`},U=n=>n.webkitRelativePath||n.name,q=n=>`${U(n)}\0${n.size}\0${n.lastModified}`,Ce=s("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-full h-full",children:s("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5m-13.5-9L12 3m0 0l4.5 4.5M12 3v13.5"})}),Ee=s("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-full h-full",children:s("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 9.776c.112-.017.227-.026.344-.026h15.812c.117 0 .232.009.344.026m-16.5 0a2.25 2.25 0 00-1.883 2.542l.857 6a2.25 2.25 0 002.227 1.932H19.05a2.25 2.25 0 002.227-1.932l.857-6a2.25 2.25 0 00-1.883-2.542m-16.5 0V6A2.25 2.25 0 016 3.75h3.879a1.5 1.5 0 011.06.44l2.122 2.12a1.5 1.5 0 001.06.44H18A2.25 2.25 0 0120.25 9v.776"})}),Le=0,Be=1e4;async function Me(n,{keep:p=()=>!0,wanted:h=1/0}={}){let I=[],S=0,g=0,i=()=>S>=h||g>=Be,P=async v=>{if(!i()){if(g++,v.isFile){let t=await new Promise((r,k)=>v.file(r,k));I.push(t),p(t)&&S++}else if(v.isDirectory){let t=v.createReader(),r=()=>new Promise((D,W)=>t.readEntries(D,W)),k=await r();for(;k.length>0&&!i();){for(let D of k)await P(D);i()||(k=await r())}}}};for(let v of n)await P(v);return I}function $e({value:n,onChange:p,accept:h,multiple:I=!1,maxSize:S=10*1024*1024,maxFiles:g,mode:i="file",variant:P="dropzone",size:v="md",disabled:t=!1,readOnly:r=!1,label:k,helperText:D,error:W,showFileList:J=!0,placeholder:Q,browseLabel:R,browseFolderLabel:X,labels:ce,icon:fe,onReject:j,className:de}){let o=Se(ce),[O,ue]=ne([]),M=Z(O),[ee,_]=ne(!1),F=Z(null),H=Z(null),V=we(),u=Ie(V,{helperText:D,error:W}),b=n!==void 0,C=b?n.map((e,f)=>({file:e,id:`ctrl-${f}`})):O,c=De[v],N=m(e=>{M.current=e,ue(e),p?.(e.map(f=>f.file))},[p]),w=I||i!=="file";Fe(()=>{i==="directory"&&F.current&&F.current.setAttribute("webkitdirectory",""),i==="both"&&H.current&&H.current.setAttribute("webkitdirectory","")},[i]);let G=le(()=>ae(S),[S]),K=le(()=>h?h.split(",").map(e=>e.trim()).map(e=>e.startsWith(".")?e.toUpperCase():e.endsWith("/*")?e.replace("/*","").toUpperCase():e).join(", "):o.fileSelectorAllFiles,[h,o.fileSelectorAllFiles]),te=i==="directory"?o.fileSelectorDropFolder:i==="both"?o.fileSelectorDropFilesOrFolders:I?o.fileSelectorDropFiles:o.fileSelectorDropFile,pe=i==="directory"?o.fileSelectorBrowseFolder:o.fileSelectorBrowse,ge=o.fileSelectorBrowseFolder,re=B(o.fileSelectorTooLarge,{maxSize:G}),oe=B(o.fileSelectorTypeNotAccepted,{accept:K}),$=m(e=>e.size>S?re:Ne(e,h)?null:oe,[h,S,re,oe]),A=m(e=>{if(t||r)return;let f=Array.from(e),y=[],T=new Set(w?(b?n??[]:M.current.map(l=>l.file)).map(q):[]);for(let l of f){let a=$(l);a?j?.(l,a):T.has(q(l))?j?.(l,o.fileSelectorAlreadyAdded):(w&&T.add(q(l)),y.push(l))}if(y.length!==0)if(b)if(w){let a=[...n??[],...y],L=g?a.slice(0,g):a;p?.(L)}else p?.([y[0]]);else{let l=y.map(a=>({file:a,id:`file-${++Le}`}));if(w){let a=[...M.current,...l];N(g?a.slice(0,g):a)}else N([l[0]])}},[t,r,b,w,g,n,p,j,$,N,o.fileSelectorAlreadyAdded]),he=m(e=>{if(!(t||r)){if(b){let f=(n??[]).filter((y,T)=>T!==e);p?.(f)}else N(M.current.filter((f,y)=>y!==e));F.current&&(F.current.value="")}},[t,r,b,n,p,N]),ye=m(()=>{t||r||(b?p?.([]):N([]),F.current&&(F.current.value=""))},[t,r,b,p,N]),ie=m(e=>{e.target.files&&e.target.files.length>0&&A(e.target.files)},[A]),me=m(e=>{e.preventDefault(),e.stopPropagation(),!t&&!r&&_(!0)},[t,r]),be=m(e=>{e.preventDefault(),e.stopPropagation(),_(!1)},[]),xe=m(e=>{if(e.preventDefault(),e.stopPropagation(),_(!1),t||r)return;let f=e.dataTransfer.items;if(f&&f.length>0&&(i==="directory"||i==="both")){let y=[];for(let l=0;l<f.length;l++){let a=f[l].webkitGetAsEntry?.();a&&y.push(a)}if(y.some(l=>l.isDirectory)){let l=b?(n??[]).length:M.current.length,a=g?Math.max(0,g-l):1/0;if(a===0)return;Me(y,{keep:L=>$(L)===null,wanted:a}).then(L=>{L.length>0&&A(L)});return}}e.dataTransfer.files&&e.dataTransfer.files.length>0&&A(e.dataTransfer.files)},[t,r,i,A,b,n,g,$]),z=m(()=>{!t&&!r&&F.current?.click()},[t,r]),se=m(()=>{!t&&!r&&H.current?.click()},[t,r]),E=C.length>0,ve=fe||(i==="directory"?Ee:Ce),ke=J&&E&&x("div",{className:d("flex flex-col",c.gap),children:[C.map((e,f)=>x("div",{className:d("flex items-center justify-between rounded-md border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50",c.fileItem),children:[x("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[s("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-4 h-4 shrink-0 text-gray-500 dark:text-gray-400",children:s("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})}),s("span",{className:"truncate text-gray-700 dark:text-gray-300",children:U(e.file)}),x("span",{className:"shrink-0 text-gray-500 dark:text-gray-400",children:["(",ae(e.file.size),")"]})]}),!t&&!r&&s("button",{type:"button",onClick:()=>he(f),className:"shrink-0 ml-2 text-gray-500 hover:text-red-600 dark:text-gray-400 dark:hover:text-red-400 transition-colors cursor-pointer","aria-label":B(o.fileSelectorRemove,{name:U(e.file)}),children:s("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-4 h-4",children:s("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]},e.id)),w&&C.length>1&&!t&&!r&&s("button",{type:"button",onClick:ye,className:d("self-start text-gray-500 hover:text-red-600 dark:text-gray-400 dark:hover:text-red-400 transition-colors cursor-pointer",c.subtext),children:o.fileSelectorRemoveAll})]}),Y=d("rounded-md border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-200 font-medium transition-colors","hover:bg-gray-50 dark:hover:bg-gray-700","disabled:opacity-50 disabled:cursor-not-allowed cursor-pointer","focus:outline-none focus:ring-2 focus:ring-synertech-primary-500 focus:ring-offset-1",c.button,u.invalid&&"border-red-500 dark:border-red-500");return x("div",{className:d("flex flex-col",c.gap,de),children:[k&&s("label",{htmlFor:V,className:d("block font-medium text-gray-700 dark:text-gray-300",c.text),children:k}),s("input",{ref:F,id:V,type:"file",accept:i!=="directory"?h:void 0,multiple:w,onChange:ie,className:"sr-only",tabIndex:-1,disabled:t||r,"aria-describedby":u.describedBy,"aria-invalid":u.invalid||void 0}),i==="both"&&s("input",{ref:H,type:"file",onChange:ie,className:"sr-only",disabled:t||r,tabIndex:-1,"aria-hidden":"true"}),P==="dropzone"?x("div",{role:i==="both"?"group":"button",tabIndex:i==="both"?void 0:t||r?-1:0,onClick:i==="both"?void 0:z,onKeyDown:i==="both"?void 0:e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),z())},onDragOver:me,onDragLeave:be,onDrop:xe,className:d("flex flex-col items-center justify-center rounded-lg border-2 border-dashed transition-colors",c.dropzone,ee&&!t&&!r?"border-synertech-primary-500 bg-synertech-primary-50 dark:bg-synertech-primary-900/20":"border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800",!t&&!r&&"hover:border-synertech-primary-400 dark:hover:border-synertech-primary-500 hover:bg-gray-50 dark:hover:bg-gray-800/70",i!=="both"&&!t&&!r&&"cursor-pointer",t&&"opacity-50 cursor-not-allowed",r&&"cursor-default",u.invalid&&"border-red-500 dark:border-red-500"),"aria-label":i==="both"?o.fileSelectorDropZone:Q||te,"aria-describedby":u.describedBy,children:[s("div",{className:d("text-gray-500 dark:text-gray-400 mb-2",c.icon,ee&&"text-synertech-primary-600 dark:text-synertech-primary-400"),children:ve}),x("p",{className:d("text-gray-600 dark:text-gray-400",c.text),children:[Q||te," ",!t&&!r&&i!=="both"&&s("span",{className:"text-synertech-primary-600 dark:text-synertech-primary-400 font-medium",children:R||pe})]}),i==="both"&&!t&&!r&&x("div",{className:d("flex items-center gap-3 mt-1",c.text),children:[s("button",{type:"button",onClick:z,className:"text-synertech-primary-600 dark:text-synertech-primary-400 font-medium hover:underline cursor-pointer focus:outline-none focus:ring-2 focus:ring-synertech-primary-500 focus:ring-offset-1 rounded",children:R||o.fileSelectorBrowseFiles}),s("span",{className:"text-gray-500 dark:text-gray-400",children:"\xB7"}),s("button",{type:"button",onClick:se,className:"text-synertech-primary-600 dark:text-synertech-primary-400 font-medium hover:underline cursor-pointer focus:outline-none focus:ring-2 focus:ring-synertech-primary-500 focus:ring-offset-1 rounded",children:X||ge})]}),s("p",{className:d("text-gray-500 dark:text-gray-400 mt-1",c.subtext),children:w&&g?B(o.fileSelectorConstraintsMaxFiles,{accept:K,maxSize:G,maxFiles:g}):B(o.fileSelectorConstraints,{accept:K,maxSize:G})})]}):x("div",{className:"flex items-center gap-2",children:[i==="both"?x(Ae,{children:[s("button",{type:"button",onClick:z,disabled:t||r,className:Y,"aria-describedby":u.describedBy,children:R||(E?o.fileSelectorChangeFiles:o.fileSelectorChooseFiles)}),s("button",{type:"button",onClick:se,disabled:t||r,className:Y,"aria-describedby":u.describedBy,children:X||o.fileSelectorChooseFolder})]}):s("button",{type:"button",onClick:z,disabled:t||r,className:Y,"aria-describedby":u.describedBy,children:R||(i==="directory"?E?o.fileSelectorChangeFolder:o.fileSelectorChooseFolder:E?o.fileSelectorChangeFile:o.fileSelectorChooseFile)}),!E&&s("span",{className:d("text-gray-500 dark:text-gray-400",c.text),children:i==="directory"?o.fileSelectorNoFolder:i==="both"?o.fileSelectorNoFileOrFolder:o.fileSelectorNoFile}),E&&!J&&s("span",{className:d("text-gray-600 dark:text-gray-400 truncate",c.text),children:C.length===1?U(C[0].file):B(o.fileSelectorFilesSelected,{count:C.length})})]}),ke,u.message!==void 0&&s("p",{id:u.ids.error,className:d("text-red-600 dark:text-red-400",c.subtext),children:u.message}),u.showHelper&&s("p",{id:u.ids.helper,className:d(u.invalid?"text-red-600 dark:text-red-400":"text-gray-500 dark:text-gray-400",c.subtext),children:D})]})}export{Be as DIRECTORY_ENTRY_LIMIT,$e as FileSelector,Me as readDirectoryEntries};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var l=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var I=Object.prototype.hasOwnProperty;var N=(e,r)=>{for(var o in r)l(e,o,{get:r[o],enumerable:!0})},P=(e,r,o,d)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of y(r))!I.call(e,i)&&i!==o&&l(e,i,{get:()=>r[i],enumerable:!(d=v(r,i))||d.enumerable});return e};var R=e=>P(l({},"__esModule",{value:!0}),e);var q={};N(q,{FormField:()=>x});module.exports=R(q);var c=require("react"),p=require("../shared/field-error.cjs"),f=require("../shared/InputWrapper.cjs"),F=require("react/jsx-runtime");function x({label:e,hideLabel:r=!1,description:o,helperText:d,error:i,required:s=!1,inline:b=!1,id:u,children:m}){let g=(0,c.useId)(),a=u||g,n=(0,p.describeField)(a,{description:o,helperText:d,error:i}),h=e!=null&&e!==""&&typeof e!="boolean",t={id:a};return n.describedBy&&(t["aria-describedby"]=n.describedBy),n.invalid&&(t["aria-invalid"]=!0),s&&(t["aria-required"]=!0),(0,F.jsx)(f.InputWrapper,{label:e,hideLabel:r,description:o,helperText:d,error:i,required:s,inline:b,htmlFor:a,children:m(t,{labelId:h?n.ids.label:void 0,invalid:n.invalid})})}0&&(module.exports={FormField});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useId as b}from"react";import{describeField as u}from"../shared/field-error.js";import{InputWrapper as m}from"../shared/InputWrapper.js";import{jsx as g}from"react/jsx-runtime";function I({label:e,hideLabel:l=!1,description:d,helperText:n,error:t,required:a=!1,inline:s=!1,id:c,children:p}){let f=b(),o=c||f,r=u(o,{description:d,helperText:n,error:t}),F=e!=null&&e!==""&&typeof e!="boolean",i={id:o};return r.describedBy&&(i["aria-describedby"]=r.describedBy),r.invalid&&(i["aria-invalid"]=!0),a&&(i["aria-required"]=!0),g(m,{label:e,hideLabel:l,description:d,helperText:n,error:t,required:a,inline:s,htmlFor:o,children:p(i,{labelId:F?r.ids.label:void 0,invalid:r.invalid})})}export{I as FormField};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var m=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var f=(r,o)=>{for(var e in o)m(r,e,{get:o[e],enumerable:!0})},s=(r,o,e,l)=>{if(o&&typeof o=="object"||typeof o=="function")for(let F of i(o))!p.call(r,F)&&F!==e&&m(r,F,{get:()=>o[F],enumerable:!(l=d(o,F))||l.enumerable});return r};var x=r=>s(m({},"__esModule",{value:!0}),r);var P={};f(P,{FormField:()=>t.FormField});module.exports=x(P);var t=require("./FormField.cjs");0&&(module.exports={FormField});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{FormField as F}from"./FormField.js";export{F as FormField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var p=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var F=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var s=(t,o)=>{for(var r in o)p(t,r,{get:o[r],enumerable:!0})},I=(t,o,r,n)=>{if(o&&typeof o=="object"||typeof o=="function")for(let e of F(o))!l.call(t,e)&&e!==r&&p(t,e,{get:()=>o[e],enumerable:!(n=x(o,e))||n.enumerable});return t};var y=t=>I(p({},"__esModule",{value:!0}),t);var d={};s(d,{FormField:()=>m.FormField,Input:()=>i.Input,MentionInput:()=>u.MentionInput,NumberInput:()=>f.NumberInput});module.exports=y(d);var m=require("./form-field/index.cjs"),i=require("./input/index.cjs"),u=require("./mention-input/index.cjs"),f=require("./number-input/index.cjs");0&&(module.exports={FormField,Input,MentionInput,NumberInput});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Input as
|
|
1
|
+
import{FormField as e}from"./form-field/index.js";import{Input as p}from"./input/index.js";import{MentionInput as m}from"./mention-input/index.js";import{NumberInput as u}from"./number-input/index.js";export{e as FormField,p as Input,m as MentionInput,u as NumberInput};
|