@gbmtech/aurora-ui 0.2.49 → 0.2.51

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.
@@ -1,2 +1,2 @@
1
- "use strict";let __rslib_import_meta_url__="undefined"==typeof document?new(require("url".replace("",""))).URL("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href;var __webpack_require__={};__webpack_require__.d=(e,_)=>{for(var t in _)__webpack_require__.o(_,t)&&!__webpack_require__.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:_[t]})},__webpack_require__.o=(e,_)=>Object.prototype.hasOwnProperty.call(e,_),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{AutoCompleteInput:()=>AutoCompleteInput});let jsx_runtime_namespaceObject=require("react/jsx-runtime"),external_command_cjs_namespaceObject=require("../command.cjs"),external_autocomplete_context_cjs_namespaceObject=require("./autocomplete-context.cjs");function AutoCompleteInput(e){let{value:_,onValueChange:t,onOpenChange:r,inputRef:o}=(0,external_autocomplete_context_cjs_namespaceObject.useAutoCompleteContext)();return(0,jsx_runtime_namespaceObject.jsx)(external_command_cjs_namespaceObject.CommandInput,{...e,ref:o,value:_,onValueChange:function(_){t?.(_),e.onValueChange?.(_)},onFocus:()=>r(!0),onBlur:()=>r(!1)})}for(var __webpack_i__ in exports.AutoCompleteInput=__webpack_exports__.AutoCompleteInput,__webpack_exports__)-1===["AutoCompleteInput"].indexOf(__webpack_i__)&&(exports[__webpack_i__]=__webpack_exports__[__webpack_i__]);Object.defineProperty(exports,"__esModule",{value:!0});
1
+ "use strict";let __rslib_import_meta_url__="undefined"==typeof document?new(require("url".replace("",""))).URL("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href;var __webpack_require__={};__webpack_require__.d=(e,_)=>{for(var t in _)__webpack_require__.o(_,t)&&!__webpack_require__.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:_[t]})},__webpack_require__.o=(e,_)=>Object.prototype.hasOwnProperty.call(e,_),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{AutoCompleteInput:()=>AutoCompleteInput});let jsx_runtime_namespaceObject=require("react/jsx-runtime"),external_command_cjs_namespaceObject=require("../command.cjs"),external_autocomplete_context_cjs_namespaceObject=require("./autocomplete-context.cjs");function AutoCompleteInput(e){let{value:_,onValueChange:t,onOpenChange:r,inputRef:o}=(0,external_autocomplete_context_cjs_namespaceObject.useAutoCompleteContext)();return(0,jsx_runtime_namespaceObject.jsx)(external_command_cjs_namespaceObject.CommandInput,{...e,ref:o,value:e.value||_,onValueChange:function(_){t?.(_),e.onValueChange?.(_)},onFocus:()=>r(!0),onBlur:()=>r(!1)})}for(var __webpack_i__ in exports.AutoCompleteInput=__webpack_exports__.AutoCompleteInput,__webpack_exports__)-1===["AutoCompleteInput"].indexOf(__webpack_i__)&&(exports[__webpack_i__]=__webpack_exports__[__webpack_i__]);Object.defineProperty(exports,"__esModule",{value:!0});
2
2
  //# sourceMappingURL=autocomplete-input.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"components\\autocomplete\\autocomplete-input.cjs","sources":["webpack://@gbmtech/aurora-ui/./src/components/autocomplete/autocomplete-input.tsx"],"sourcesContent":["import type { ComponentPropsWithoutRef } from 'react'\n\nimport { CommandInput } from '../command'\nimport { useAutoCompleteContext } from './autocomplete-context'\n\nfunction AutoCompleteInput(\n props: ComponentPropsWithoutRef<typeof CommandInput>\n) {\n const { value, onValueChange, onOpenChange, inputRef } =\n useAutoCompleteContext()\n\n function handleChange(value: string) {\n onValueChange?.(value)\n props.onValueChange?.(value)\n }\n\n return (\n <CommandInput\n {...props}\n ref={inputRef}\n value={value}\n onValueChange={handleChange}\n onFocus={() => onOpenChange(true)}\n onBlur={() => onOpenChange(false)}\n />\n )\n}\n\nexport { AutoCompleteInput }\n"],"names":["AutoCompleteInput","props","value","onValueChange","onOpenChange","inputRef","useAutoCompleteContext","CommandInput"],"mappings":"0gCAKA,SAASA,kBACPC,CAAoD,EAEpD,GAAM,CAAEC,MAAAA,CAAK,CAAEC,cAAAA,CAAa,CAAEC,aAAAA,CAAY,CAAEC,SAAAA,CAAQ,CAAE,CACpDC,AAAAA,GAAAA,kDAAAA,sBAAAA,AAAAA,IAOF,MACE,oCAACC,qCAAAA,YAAYA,CAAAA,CACV,GAAGN,CAAK,CACT,IAAKI,EACL,MAAOH,EACP,cAVJ,SAAsBA,CAAa,EACjCC,IAAgBD,GAChBD,EAAM,aAAa,GAAGC,EACxB,EAQI,QAAS,IAAME,EAAa,IAC5B,OAAQ,IAAMA,EAAa,G,EAGjC,C"}
1
+ {"version":3,"file":"components\\autocomplete\\autocomplete-input.cjs","sources":["webpack://@gbmtech/aurora-ui/./src/components/autocomplete/autocomplete-input.tsx"],"sourcesContent":["import type { ComponentPropsWithoutRef } from 'react'\n\nimport { CommandInput } from '../command'\nimport { useAutoCompleteContext } from './autocomplete-context'\n\nfunction AutoCompleteInput(\n props: ComponentPropsWithoutRef<typeof CommandInput>\n) {\n const { value, onValueChange, onOpenChange, inputRef } =\n useAutoCompleteContext()\n\n function handleChange(value: string) {\n onValueChange?.(value)\n props.onValueChange?.(value)\n }\n\n return (\n <CommandInput\n {...props}\n ref={inputRef}\n value={props.value || value}\n onValueChange={handleChange}\n onFocus={() => onOpenChange(true)}\n onBlur={() => onOpenChange(false)}\n />\n )\n}\n\nexport { AutoCompleteInput }\n"],"names":["AutoCompleteInput","props","value","onValueChange","onOpenChange","inputRef","useAutoCompleteContext","CommandInput"],"mappings":"0gCAKA,SAASA,kBACPC,CAAoD,EAEpD,GAAM,CAAEC,MAAAA,CAAK,CAAEC,cAAAA,CAAa,CAAEC,aAAAA,CAAY,CAAEC,SAAAA,CAAQ,CAAE,CACpDC,AAAAA,GAAAA,kDAAAA,sBAAAA,AAAAA,IAOF,MACE,oCAACC,qCAAAA,YAAYA,CAAAA,CACV,GAAGN,CAAK,CACT,IAAKI,EACL,MAAOJ,EAAM,KAAK,EAAIC,EACtB,cAVJ,SAAsBA,CAAa,EACjCC,IAAgBD,GAChBD,EAAM,aAAa,GAAGC,EACxB,EAQI,QAAS,IAAME,EAAa,IAC5B,OAAQ,IAAMA,EAAa,G,EAGjC,C"}
@@ -1 +1 @@
1
- "use strict";let __rslib_import_meta_url__="undefined"==typeof document?new(require("url".replace("",""))).URL("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href;var __webpack_modules__={"./data-table-action-bar":function(e){e.exports=require("./data-table-action-bar.cjs")},"./data-table-advanced-toolbar":function(e){e.exports=require("./data-table-advanced-toolbar.cjs")},"./data-table-column-header":function(e){e.exports=require("./data-table-column-header.cjs")},"@/components/data-table/data-table-date-filter":function(e){e.exports=require("./data-table-date-filter.cjs")},"@/components/data-table/data-table-faceted-filter":function(e){e.exports=require("./data-table-faceted-filter.cjs")},"./data-table-filter-list":function(e){e.exports=require("./data-table-filter-list.cjs")},"./data-table-filter-menu":function(e){e.exports=require("./data-table-filter-menu.cjs")},"@/components/data-table/data-table-pagination":function(e){e.exports=require("./data-table-pagination.cjs")},"@/components/data-table/data-table-range-filter":function(e){e.exports=require("./data-table-range-filter.cjs")},"./data-table-skeleton":function(e){e.exports=require("./data-table-skeleton.cjs")},"@/components/data-table/data-table-slider-filter":function(e){e.exports=require("./data-table-slider-filter.cjs")},"./data-table-sort-list":function(e){e.exports=require("./data-table-sort-list.cjs")},"./data-table-toolbar":function(e){e.exports=require("./data-table-toolbar.cjs")},"@/components/data-table/data-table-view-options":function(e){e.exports=require("./data-table-view-options.cjs")},"./data-table":function(e){e.exports=require("./data-table.cjs")}},__webpack_module_cache__={};function __webpack_require__(e){var _=__webpack_module_cache__[e];if(void 0!==_)return _.exports;var a=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e](a,a.exports,__webpack_require__),a.exports}__webpack_require__.n=e=>{var _=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(_,{a:_}),_},__webpack_require__.d=(e,_)=>{for(var a in _)__webpack_require__.o(_,a)&&!__webpack_require__.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:_[a]})},__webpack_require__.o=(e,_)=>Object.prototype.hasOwnProperty.call(e,_),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};for(var __webpack_i__ in(()=>{__webpack_require__.r(__webpack_exports__);var e=__webpack_require__("./data-table-action-bar"),_={};for(var a in e)"default"!==a&&(_[a]=(function(_){return e[_]}).bind(0,a));__webpack_require__.d(__webpack_exports__,_);var t=__webpack_require__("./data-table-advanced-toolbar"),_={};for(var a in t)"default"!==a&&(_[a]=(function(e){return t[e]}).bind(0,a));__webpack_require__.d(__webpack_exports__,_);var r=__webpack_require__("./data-table-column-header"),_={};for(var a in r)"default"!==a&&(_[a]=(function(e){return r[e]}).bind(0,a));__webpack_require__.d(__webpack_exports__,_);var n=__webpack_require__("@/components/data-table/data-table-date-filter"),_={};for(var a in n)"default"!==a&&(_[a]=(function(e){return n[e]}).bind(0,a));__webpack_require__.d(__webpack_exports__,_);var i=__webpack_require__("@/components/data-table/data-table-faceted-filter"),_={};for(var a in i)"default"!==a&&(_[a]=(function(e){return i[e]}).bind(0,a));__webpack_require__.d(__webpack_exports__,_);var o=__webpack_require__("./data-table-filter-list"),_={};for(var a in o)"default"!==a&&(_[a]=(function(e){return o[e]}).bind(0,a));__webpack_require__.d(__webpack_exports__,_);var c=__webpack_require__("./data-table-filter-menu"),_={};for(var a in c)"default"!==a&&(_[a]=(function(e){return c[e]}).bind(0,a));__webpack_require__.d(__webpack_exports__,_);var b=__webpack_require__("@/components/data-table/data-table-pagination"),_={};for(var a in b)"default"!==a&&(_[a]=(function(e){return b[e]}).bind(0,a));__webpack_require__.d(__webpack_exports__,_);var u=__webpack_require__("@/components/data-table/data-table-range-filter"),_={};for(var a in u)"default"!==a&&(_[a]=(function(e){return u[e]}).bind(0,a));__webpack_require__.d(__webpack_exports__,_);var d=__webpack_require__("./data-table-skeleton"),_={};for(var a in d)"default"!==a&&(_[a]=(function(e){return d[e]}).bind(0,a));__webpack_require__.d(__webpack_exports__,_);var p=__webpack_require__("@/components/data-table/data-table-slider-filter"),_={};for(var a in p)"default"!==a&&(_[a]=(function(e){return p[e]}).bind(0,a));__webpack_require__.d(__webpack_exports__,_);var l=__webpack_require__("./data-table-sort-list"),_={};for(var a in l)"default"!==a&&(_[a]=(function(e){return l[e]}).bind(0,a));__webpack_require__.d(__webpack_exports__,_);var f=__webpack_require__("./data-table-toolbar"),_={};for(var a in f)"default"!==a&&(_[a]=(function(e){return f[e]}).bind(0,a));__webpack_require__.d(__webpack_exports__,_);var s=__webpack_require__("@/components/data-table/data-table-view-options"),_={};for(var a in s)"default"!==a&&(_[a]=(function(e){return s[e]}).bind(0,a));__webpack_require__.d(__webpack_exports__,_);var w=__webpack_require__("./data-table"),_={};for(var a in w)"default"!==a&&(_[a]=(function(e){return w[e]}).bind(0,a));__webpack_require__.d(__webpack_exports__,_)})(),__webpack_exports__)exports[__webpack_i__]=__webpack_exports__[__webpack_i__];Object.defineProperty(exports,"__esModule",{value:!0});
1
+ "use strict";let __rslib_import_meta_url__="undefined"==typeof document?new(require("url".replace("",""))).URL("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href;var __webpack_modules__={"./data-table-action-bar":function(e){e.exports=require("./data-table-action-bar.cjs")},"./data-table-advanced-toolbar":function(e){e.exports=require("./data-table-advanced-toolbar.cjs")},"./data-table-column-header":function(e){e.exports=require("./data-table-column-header.cjs")},"@/components/data-table/data-table-date-filter":function(e){e.exports=require("./data-table-date-filter.cjs")},"@/components/data-table/data-table-faceted-filter":function(e){e.exports=require("./data-table-faceted-filter.cjs")},"./data-table-filter-list":function(e){e.exports=require("./data-table-filter-list.cjs")},"./data-table-filter-menu":function(e){e.exports=require("./data-table-filter-menu.cjs")},"@/components/data-table/data-table-pagination":function(e){e.exports=require("./data-table-pagination.cjs")},"./data-table-range-filter":function(e){e.exports=require("./data-table-range-filter.cjs")},"./data-table-skeleton":function(e){e.exports=require("./data-table-skeleton.cjs")},"@/components/data-table/data-table-slider-filter":function(e){e.exports=require("./data-table-slider-filter.cjs")},"./data-table-sort-list":function(e){e.exports=require("./data-table-sort-list.cjs")},"./data-table-toolbar":function(e){e.exports=require("./data-table-toolbar.cjs")},"@/components/data-table/data-table-view-options":function(e){e.exports=require("./data-table-view-options.cjs")},"./data-table":function(e){e.exports=require("./data-table.cjs")}},__webpack_module_cache__={};function __webpack_require__(e){var _=__webpack_module_cache__[e];if(void 0!==_)return _.exports;var a=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e](a,a.exports,__webpack_require__),a.exports}__webpack_require__.n=e=>{var _=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(_,{a:_}),_},__webpack_require__.d=(e,_)=>{for(var a in _)__webpack_require__.o(_,a)&&!__webpack_require__.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:_[a]})},__webpack_require__.o=(e,_)=>Object.prototype.hasOwnProperty.call(e,_),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};for(var __webpack_i__ in(()=>{__webpack_require__.r(__webpack_exports__);var e=__webpack_require__("./data-table-action-bar"),_={};for(var a in e)"default"!==a&&(_[a]=(function(_){return e[_]}).bind(0,a));__webpack_require__.d(__webpack_exports__,_);var r=__webpack_require__("./data-table-advanced-toolbar"),_={};for(var a in r)"default"!==a&&(_[a]=(function(e){return r[e]}).bind(0,a));__webpack_require__.d(__webpack_exports__,_);var t=__webpack_require__("./data-table-column-header"),_={};for(var a in t)"default"!==a&&(_[a]=(function(e){return t[e]}).bind(0,a));__webpack_require__.d(__webpack_exports__,_);var i=__webpack_require__("@/components/data-table/data-table-date-filter"),_={};for(var a in i)"default"!==a&&(_[a]=(function(e){return i[e]}).bind(0,a));__webpack_require__.d(__webpack_exports__,_);var n=__webpack_require__("@/components/data-table/data-table-faceted-filter"),_={};for(var a in n)"default"!==a&&(_[a]=(function(e){return n[e]}).bind(0,a));__webpack_require__.d(__webpack_exports__,_);var o=__webpack_require__("./data-table-filter-list"),_={};for(var a in o)"default"!==a&&(_[a]=(function(e){return o[e]}).bind(0,a));__webpack_require__.d(__webpack_exports__,_);var c=__webpack_require__("./data-table-filter-menu"),_={};for(var a in c)"default"!==a&&(_[a]=(function(e){return c[e]}).bind(0,a));__webpack_require__.d(__webpack_exports__,_);var b=__webpack_require__("@/components/data-table/data-table-pagination"),_={};for(var a in b)"default"!==a&&(_[a]=(function(e){return b[e]}).bind(0,a));__webpack_require__.d(__webpack_exports__,_);var u=__webpack_require__("./data-table-range-filter"),_={};for(var a in u)"default"!==a&&(_[a]=(function(e){return u[e]}).bind(0,a));__webpack_require__.d(__webpack_exports__,_);var d=__webpack_require__("./data-table-skeleton"),_={};for(var a in d)"default"!==a&&(_[a]=(function(e){return d[e]}).bind(0,a));__webpack_require__.d(__webpack_exports__,_);var p=__webpack_require__("@/components/data-table/data-table-slider-filter"),_={};for(var a in p)"default"!==a&&(_[a]=(function(e){return p[e]}).bind(0,a));__webpack_require__.d(__webpack_exports__,_);var l=__webpack_require__("./data-table-sort-list"),_={};for(var a in l)"default"!==a&&(_[a]=(function(e){return l[e]}).bind(0,a));__webpack_require__.d(__webpack_exports__,_);var f=__webpack_require__("./data-table-toolbar"),_={};for(var a in f)"default"!==a&&(_[a]=(function(e){return f[e]}).bind(0,a));__webpack_require__.d(__webpack_exports__,_);var s=__webpack_require__("@/components/data-table/data-table-view-options"),_={};for(var a in s)"default"!==a&&(_[a]=(function(e){return s[e]}).bind(0,a));__webpack_require__.d(__webpack_exports__,_);var w=__webpack_require__("./data-table"),_={};for(var a in w)"default"!==a&&(_[a]=(function(e){return w[e]}).bind(0,a));__webpack_require__.d(__webpack_exports__,_)})(),__webpack_exports__)exports[__webpack_i__]=__webpack_exports__[__webpack_i__];Object.defineProperty(exports,"__esModule",{value:!0});
@@ -1 +1 @@
1
- {"version":3,"file":"components\\form.cjs","sources":["webpack://@gbmtech/aurora-ui/./src/components/form.tsx"],"sourcesContent":["\r\n\r\nimport type { Scope } from '@radix-ui/react-context'\r\nimport type * as LabelPrimitive from '@radix-ui/react-label'\r\nimport type { ComponentProps, JSX, ReactNode } from 'react'\r\nimport type {\r\n ControllerProps,\r\n FieldError,\r\n FieldPath,\r\n FieldValues,\r\n} from 'react-hook-form'\r\n\r\nimport { createContextScope } from '@radix-ui/react-context'\r\nimport { Slot } from '@radix-ui/react-slot'\r\nimport { useId } from 'react'\r\nimport {\r\n Controller,\r\n FormProvider,\r\n useFormContext,\r\n useFormState,\r\n} from 'react-hook-form'\r\n\r\nimport { Label } from '@/components/label'\r\nimport { cn } from '@/lib/utils'\r\n\r\n/* -----------------------------------------------------------------------------\r\n * Component: Form\r\n * -------------------------------------------------------------------------- */\r\n\r\nconst Form = FormProvider\r\n\r\n/* -----------------------------------------------------------------------------\r\n * Context: FormField\r\n * -------------------------------------------------------------------------- */\r\n\r\nconst FORM_FIELD_NAME = 'FormField'\r\n\r\ntype ScopedProps<P> = P & { __scopeFormField?: Scope }\r\n\r\nconst [createFormFieldContext, createFormFieldScope] =\r\n createContextScope(FORM_FIELD_NAME)\r\n\r\ninterface FormFieldContextValue<\r\n TFieldValues extends FieldValues = FieldValues,\r\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\r\n> {\r\n name: TName\r\n}\r\n\r\nconst [FormFieldContextProvider, useFormFieldContext] =\r\n createFormFieldContext<FormFieldContextValue>(FORM_FIELD_NAME)\r\n\r\nfunction useFormItem(\r\n consumerName: string,\r\n scope: Scope\r\n): {\r\n formDescriptionId: string\r\n formItemId: string\r\n formMessageId: string\r\n id: string\r\n invalid: boolean\r\n isDirty: boolean\r\n isTouched: boolean\r\n isValidating: boolean\r\n name: string\r\n error?: FieldError\r\n} {\r\n const { id } = useFormItemContext(consumerName, scope)\r\n const { name } = useFormFieldContext(consumerName, scope)\r\n const { getFieldState } = useFormContext()\r\n const formState = useFormState({ name })\r\n const fieldState = getFieldState(name, formState)\r\n\r\n return {\r\n id,\r\n name,\r\n formDescriptionId: `form-item-description-${id}`,\r\n formItemId: `form-item-${id}`,\r\n formMessageId: `form-item-message-${id}`,\r\n ...fieldState,\r\n }\r\n}\r\n\r\n/* -----------------------------------------------------------------------------\r\n * Component: FormField\r\n * -------------------------------------------------------------------------- */\r\n\r\nfunction FormField<\r\n TFieldValues extends FieldValues = FieldValues,\r\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\r\n>(\r\n formFieldProps: ScopedProps<ControllerProps<TFieldValues, TName>>\r\n): JSX.Element {\r\n const { __scopeFormField, ...props } = formFieldProps\r\n\r\n return (\r\n <FormFieldContextProvider name={props.name} scope={__scopeFormField}>\r\n <Controller {...props} />\r\n </FormFieldContextProvider>\r\n )\r\n}\r\n\r\n/* -----------------------------------------------------------------------------\r\n * Context: FormItem\r\n * -------------------------------------------------------------------------- */\r\n\r\nconst FORM_ITEM_NAME = 'FormItem'\r\n\r\ninterface FormItemContextValue {\r\n id: string\r\n}\r\n\r\nconst [FormItemContextProvider, useFormItemContext] =\r\n createFormFieldContext<FormItemContextValue>(FORM_ITEM_NAME)\r\n\r\n/* -----------------------------------------------------------------------------\r\n * Component: FormItem\r\n * -------------------------------------------------------------------------- */\r\n\r\nfunction FormItem({\r\n __scopeFormField,\r\n className,\r\n ...props\r\n}: ScopedProps<ComponentProps<'div'>>): JSX.Element {\r\n const id = useId()\r\n\r\n return (\r\n <FormItemContextProvider id={id} scope={__scopeFormField}>\r\n <div\r\n className={cn('space-y-2', className)}\r\n data-slot=\"form-item\"\r\n {...props}\r\n />\r\n </FormItemContextProvider>\r\n )\r\n}\r\n\r\n/* -----------------------------------------------------------------------------\r\n * Component: FormLabel\r\n * -------------------------------------------------------------------------- */\r\n\r\nconst FORM_LABEL_NAME = 'FormLabel'\r\n\r\nfunction FormLabel({\r\n __scopeFormField,\r\n ...props\r\n}: ScopedProps<ComponentProps<typeof LabelPrimitive.Root>>): JSX.Element {\r\n const { formItemId, error } = useFormItem(FORM_LABEL_NAME, __scopeFormField)\r\n\r\n return (\r\n <Label\r\n data-invalid={error ? true : undefined}\r\n data-slot=\"form-label\"\r\n htmlFor={formItemId}\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\n/* -----------------------------------------------------------------------------\r\n * Component: FormControl\r\n * -------------------------------------------------------------------------- */\r\n\r\nconst FORM_CONTROL_NAME = 'FormControl'\r\n\r\nfunction FormControl({\r\n __scopeFormField,\r\n ...props\r\n}: ScopedProps<ComponentProps<typeof Slot>>): JSX.Element {\r\n const { formDescriptionId, formItemId, formMessageId, error } = useFormItem(\r\n FORM_CONTROL_NAME,\r\n __scopeFormField\r\n )\r\n\r\n return (\r\n <Slot\r\n aria-describedby={\r\n error ? `${formDescriptionId} ${formMessageId}` : formDescriptionId\r\n }\r\n aria-invalid={Boolean(error)}\r\n data-slot=\"form-control\"\r\n id={formItemId}\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\n/* -----------------------------------------------------------------------------\r\n * Component: FormDescription\r\n * -------------------------------------------------------------------------- */\r\n\r\nfunction FormDescription({\r\n __scopeFormField,\r\n className,\r\n ...props\r\n}: ScopedProps<ComponentProps<'p'>>): JSX.Element {\r\n const { formDescriptionId } = useFormItem(FORM_MESSAGE_NAME, __scopeFormField)\r\n\r\n return (\r\n <p\r\n className={cn('text-muted-foreground text-xs', className)}\r\n data-slot=\"form-description\"\r\n id={formDescriptionId}\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\n/* -----------------------------------------------------------------------------\r\n * Component: FormMessage\r\n * -------------------------------------------------------------------------- */\r\n\r\nconst FORM_MESSAGE_NAME = 'FormMessage'\r\n\r\nfunction FormMessage({\r\n __scopeFormField,\r\n children,\r\n className,\r\n ...props\r\n}: ScopedProps<ComponentProps<'p'>>): ReactNode {\r\n const { formMessageId, error } = useFormItem(\r\n FORM_MESSAGE_NAME,\r\n __scopeFormField\r\n )\r\n const body = error?.message ? String(error.message) : children\r\n\r\n if (!body) {\r\n return null\r\n }\r\n\r\n return (\r\n <p\r\n className={cn(\r\n 'text-xs',\r\n error?.message ? 'font-medium text-error' : 'text-gray-600',\r\n className\r\n )}\r\n data-slot=\"form-message\"\r\n id={formMessageId}\r\n {...props}\r\n >\r\n {body}\r\n </p>\r\n )\r\n}\r\n\r\n/* -----------------------------------------------------------------------------\r\n * Exports\r\n * -------------------------------------------------------------------------- */\r\n\r\nexport {\r\n createFormFieldScope,\r\n Form,\r\n FormControl,\r\n FormDescription,\r\n FormField,\r\n FormItem,\r\n FormLabel,\r\n FormMessage,\r\n}\r\n"],"names":["Form","FormProvider","FORM_FIELD_NAME","createFormFieldContext","createFormFieldScope","createContextScope","FormFieldContextProvider","useFormFieldContext","useFormItem","consumerName","scope","id","useFormItemContext","name","getFieldState","useFormContext","formState","useFormState","fieldState","FormField","formFieldProps","__scopeFormField","props","Controller","FORM_ITEM_NAME","FormItemContextProvider","FormItem","className","useId","cn","FORM_LABEL_NAME","FormLabel","formItemId","error","Label","undefined","FORM_CONTROL_NAME","FormControl","formDescriptionId","formMessageId","Slot","Boolean","FormDescription","FORM_MESSAGE_NAME","FormMessage","children","body","String"],"mappings":";y4CA6BMA,KAAOC,yCAAAA,YAAYA,CAMnBC,gBAAkB,YAIlB,CAACC,uBAAwBC,qBAAqB,CAClDC,GAAAA,8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T,UACAI,GAAO,QAAU,yBAA2B,gBAC5CN,GAEF,YAAU,eACV,GAAIY,EACH,GAAGjB,CAAK,C,SAERwB,C,GAdI,IAiBX,C"}
1
+ {"version":3,"file":"components\\form.cjs","sources":["webpack://@gbmtech/aurora-ui/./src/components/form.tsx"],"sourcesContent":["\r\n\r\nimport type { Scope } from '@radix-ui/react-context'\r\nimport type { ComponentProps, JSX, ReactNode } from 'react'\r\nimport type {\r\n ControllerProps,\r\n FieldError,\r\n FieldPath,\r\n FieldValues,\r\n} from 'react-hook-form'\r\n\r\nimport { createContextScope } from '@radix-ui/react-context'\r\nimport { Slot } from '@radix-ui/react-slot'\r\nimport { useId } from 'react'\r\nimport {\r\n Controller,\r\n FormProvider,\r\n useFormContext,\r\n useFormState,\r\n} from 'react-hook-form'\r\n\r\nimport { Label } from '@/components/label'\r\nimport { cn } from '@/lib/utils'\r\n\r\n/* -----------------------------------------------------------------------------\r\n * Component: Form\r\n * -------------------------------------------------------------------------- */\r\n\r\nconst Form = FormProvider\r\n\r\n/* -----------------------------------------------------------------------------\r\n * Context: FormField\r\n * -------------------------------------------------------------------------- */\r\n\r\nconst FORM_FIELD_NAME = 'FormField'\r\n\r\ntype ScopedProps<P> = P & { __scopeFormField?: Scope }\r\n\r\nconst [createFormFieldContext, createFormFieldScope] =\r\n createContextScope(FORM_FIELD_NAME)\r\n\r\ninterface FormFieldContextValue<\r\n TFieldValues extends FieldValues = FieldValues,\r\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\r\n> {\r\n name: TName\r\n}\r\n\r\nconst [FormFieldContextProvider, useFormFieldContext] =\r\n createFormFieldContext<FormFieldContextValue>(FORM_FIELD_NAME)\r\n\r\nfunction useFormItem(\r\n consumerName: string,\r\n scope: Scope\r\n): {\r\n formDescriptionId: string\r\n formItemId: string\r\n formMessageId: string\r\n id: string\r\n invalid: boolean\r\n isDirty: boolean\r\n isTouched: boolean\r\n isValidating: boolean\r\n name: string\r\n error?: FieldError\r\n} {\r\n const { id } = useFormItemContext(consumerName, scope)\r\n const { name } = useFormFieldContext(consumerName, scope)\r\n const { getFieldState } = useFormContext()\r\n const formState = useFormState({ name })\r\n const fieldState = getFieldState(name, formState)\r\n\r\n return {\r\n id,\r\n name,\r\n formDescriptionId: `form-item-description-${id}`,\r\n formItemId: `form-item-${id}`,\r\n formMessageId: `form-item-message-${id}`,\r\n ...fieldState,\r\n }\r\n}\r\n\r\n/* -----------------------------------------------------------------------------\r\n * Component: FormField\r\n * -------------------------------------------------------------------------- */\r\n\r\nfunction FormField<\r\n TFieldValues extends FieldValues = FieldValues,\r\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\r\n>(\r\n formFieldProps: ScopedProps<ControllerProps<TFieldValues, TName>>\r\n): JSX.Element {\r\n const { __scopeFormField, ...props } = formFieldProps\r\n\r\n return (\r\n <FormFieldContextProvider name={props.name} scope={__scopeFormField}>\r\n <Controller {...props} />\r\n </FormFieldContextProvider>\r\n )\r\n}\r\n\r\n/* -----------------------------------------------------------------------------\r\n * Context: FormItem\r\n * -------------------------------------------------------------------------- */\r\n\r\nconst FORM_ITEM_NAME = 'FormItem'\r\n\r\ninterface FormItemContextValue {\r\n id: string\r\n}\r\n\r\nconst [FormItemContextProvider, useFormItemContext] =\r\n createFormFieldContext<FormItemContextValue>(FORM_ITEM_NAME)\r\n\r\n/* -----------------------------------------------------------------------------\r\n * Component: FormItem\r\n * -------------------------------------------------------------------------- */\r\n\r\nfunction FormItem({\r\n __scopeFormField,\r\n className,\r\n ...props\r\n}: ScopedProps<ComponentProps<'div'>>): JSX.Element {\r\n const id = useId()\r\n\r\n return (\r\n <FormItemContextProvider id={id} scope={__scopeFormField}>\r\n <div\r\n className={cn('space-y-2', className)}\r\n data-slot=\"form-item\"\r\n {...props}\r\n />\r\n </FormItemContextProvider>\r\n )\r\n}\r\n\r\n/* -----------------------------------------------------------------------------\r\n * Component: FormLabel\r\n * -------------------------------------------------------------------------- */\r\n\r\nconst FORM_LABEL_NAME = 'FormLabel'\r\n\r\nfunction FormLabel({\r\n __scopeFormField,\r\n ...props\r\n}: ScopedProps<ComponentProps<typeof Label>>): JSX.Element {\r\n const { formItemId, error } = useFormItem(FORM_LABEL_NAME, __scopeFormField)\r\n\r\n return (\r\n <Label\r\n data-invalid={error ? true : undefined}\r\n data-slot=\"form-label\"\r\n htmlFor={formItemId}\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\n/* -----------------------------------------------------------------------------\r\n * Component: FormControl\r\n * -------------------------------------------------------------------------- */\r\n\r\nconst FORM_CONTROL_NAME = 'FormControl'\r\n\r\nfunction FormControl({\r\n __scopeFormField,\r\n ...props\r\n}: ScopedProps<ComponentProps<typeof Slot>>): JSX.Element {\r\n const { formDescriptionId, formItemId, formMessageId, error } = useFormItem(\r\n FORM_CONTROL_NAME,\r\n __scopeFormField\r\n )\r\n\r\n return (\r\n <Slot\r\n aria-describedby={\r\n error ? `${formDescriptionId} ${formMessageId}` : formDescriptionId\r\n }\r\n aria-invalid={Boolean(error)}\r\n data-slot=\"form-control\"\r\n id={formItemId}\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\n/* -----------------------------------------------------------------------------\r\n * Component: FormDescription\r\n * -------------------------------------------------------------------------- */\r\n\r\nfunction FormDescription({\r\n __scopeFormField,\r\n className,\r\n ...props\r\n}: ScopedProps<ComponentProps<'p'>>): JSX.Element {\r\n const { formDescriptionId } = useFormItem(FORM_MESSAGE_NAME, __scopeFormField)\r\n\r\n return (\r\n <p\r\n className={cn('text-muted-foreground text-xs', className)}\r\n data-slot=\"form-description\"\r\n id={formDescriptionId}\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\n/* -----------------------------------------------------------------------------\r\n * Component: FormMessage\r\n * -------------------------------------------------------------------------- */\r\n\r\nconst FORM_MESSAGE_NAME = 'FormMessage'\r\n\r\nfunction FormMessage({\r\n __scopeFormField,\r\n children,\r\n className,\r\n ...props\r\n}: ScopedProps<ComponentProps<'p'>>): ReactNode {\r\n const { formMessageId, error } = useFormItem(\r\n FORM_MESSAGE_NAME,\r\n __scopeFormField\r\n )\r\n const body = error?.message ? String(error.message) : children\r\n\r\n if (!body) {\r\n return null\r\n }\r\n\r\n return (\r\n <p\r\n className={cn(\r\n 'text-xs',\r\n error?.message ? 'font-medium text-error' : 'text-gray-600',\r\n className\r\n )}\r\n data-slot=\"form-message\"\r\n id={formMessageId}\r\n {...props}\r\n >\r\n {body}\r\n </p>\r\n )\r\n}\r\n\r\n/* -----------------------------------------------------------------------------\r\n * Exports\r\n * -------------------------------------------------------------------------- */\r\n\r\nexport {\r\n createFormFieldScope,\r\n Form,\r\n FormControl,\r\n FormDescription,\r\n FormField,\r\n FormItem,\r\n FormLabel,\r\n FormMessage,\r\n}\r\n"],"names":["Form","FormProvider","FORM_FIELD_NAME","createFormFieldContext","createFormFieldScope","createContextScope","FormFieldContextProvider","useFormFieldContext","useFormItem","consumerName","scope","id","useFormItemContext","name","getFieldState","useFormContext","formState","useFormState","fieldState","FormField","formFieldProps","__scopeFormField","props","Controller","FORM_ITEM_NAME","FormItemContextProvider","FormItem","className","useId","cn","FORM_LABEL_NAME","FormLabel","formItemId","error","Label","undefined","FORM_CONTROL_NAME","FormControl","formDescriptionId","formMessageId","Slot","Boolean","FormDescription","FORM_MESSAGE_NAME","FormMessage","children","body","String"],"mappings":";y4CA4BMA,KAAOC,yCAAAA,YAAYA,CAMnBC,gBAAkB,YAIlB,CAACC,uBAAwBC,qBAAqB,CAClDC,GAAAA,8BAAAA,kBAAAA,EAAmBH,iBASf,CAACI,yBAA0BC,oBAAoB,CACnDJ,uBAA8CD,iBAEhD,SAASM,YACPC,CAAoB,CACpBC,CAAY,EAaZ,GAAM,CAAEC,GAAAA,CAAE,CAAE,CAAGC,mBAAmBH,EAAcC,GAC1C,CAAEG,KAAAA,CAAI,CAAE,CAAGN,oBAAoBE,EAAcC,GAC7C,CAAEI,cAAAA,CAAa,CAAE,CAAGC,GAAAA,yCAAAA,cAAAA,IACpBC,EAAYC,G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,GAAM,CAAEgB,kBAAAA,CAAiB,CAAEN,WAAAA,CAAU,CAAEO,cAAAA,CAAa,CAAEN,MAAAA,CAAK,CAAE,CAAGzB,YANxC,cAQtBa,GAGF,MACE,oCAACmB,2BAAAA,IAAIA,CAAAA,CACH,mBACEP,EAAQ,CAAC,EAAEK,EAAkB,CAAC,EAAEC,EAAc,CAAC,CAAGD,EAEpD,eAAcG,CAAAA,CAAQR,EACtB,YAAU,eACV,GAAID,EACH,GAAGV,CAAK,EAGf,CAMA,SAASoB,gBAAgB,CACvBrB,iBAAAA,CAAgB,CAChBM,UAAAA,CAAS,CACT,GAAGL,EAC8B,EACjC,GAAM,CAAEgB,kBAAAA,CAAiB,CAAE,CAAG9B,YAAYmC,kBAAmBtB,GAE7D,MACE,oCAAC,KACC,UAAWQ,GAAAA,0BAAAA,EAAAA,EAAG,gCAAiCF,GAC/C,YAAU,mBACV,GAAIW,EACH,GAAGhB,CAAK,EAGf,CAMA,IAAMqB,kBAAoB,cAE1B,SAASC,YAAY,CACnBvB,iBAAAA,CAAgB,CAChBwB,SAAAA,CAAQ,CACRlB,UAAAA,CAAS,CACT,GAAGL,EAC8B,EACjC,GAAM,CAAEiB,cAAAA,CAAa,CAAEN,MAAAA,CAAK,CAAE,CAAGzB,YAC/BmC,kBACAtB,GAEIyB,EAAOb,GAAO,QAAUc,OAAOd,EAAM,OAAO,EAAIY,SAEtD,EAKE,oCAAC,KACC,UAAWhB,GAAAA,0BAAAA,EAAAA,EACT,UACAI,GAAO,QAAU,yBAA2B,gBAC5CN,GAEF,YAAU,eACV,GAAIY,EACH,GAAGjB,CAAK,C,SAERwB,C,GAdI,IAiBX,C"}
@@ -1,2 +1,2 @@
1
- import*as o from"react/jsx-runtime";import*as t from"../command.js";import*as e from"./autocomplete-context.js";function n(n){let{value:u,onValueChange:m,onOpenChange:r,inputRef:a}=(0,e.useAutoCompleteContext)();return(0,o.jsx)(t.CommandInput,{...n,ref:a,value:u,onValueChange:function(o){m?.(o),n.onValueChange?.(o)},onFocus:()=>r(!0),onBlur:()=>r(!1)})}export{n as AutoCompleteInput};
1
+ import*as o from"react/jsx-runtime";import*as t from"../command.js";import*as e from"./autocomplete-context.js";function n(n){let{value:u,onValueChange:m,onOpenChange:a,inputRef:r}=(0,e.useAutoCompleteContext)();return(0,o.jsx)(t.CommandInput,{...n,ref:r,value:n.value||u,onValueChange:function(o){m?.(o),n.onValueChange?.(o)},onFocus:()=>a(!0),onBlur:()=>a(!1)})}export{n as AutoCompleteInput};
2
2
  //# sourceMappingURL=autocomplete-input.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"components\\autocomplete\\autocomplete-input.js","sources":["webpack://@gbmtech/aurora-ui/./src/components/autocomplete/autocomplete-input.tsx"],"sourcesContent":["import type { ComponentPropsWithoutRef } from 'react'\n\nimport { CommandInput } from '../command'\nimport { useAutoCompleteContext } from './autocomplete-context'\n\nfunction AutoCompleteInput(\n props: ComponentPropsWithoutRef<typeof CommandInput>\n) {\n const { value, onValueChange, onOpenChange, inputRef } =\n useAutoCompleteContext()\n\n function handleChange(value: string) {\n onValueChange?.(value)\n props.onValueChange?.(value)\n }\n\n return (\n <CommandInput\n {...props}\n ref={inputRef}\n value={value}\n onValueChange={handleChange}\n onFocus={() => onOpenChange(true)}\n onBlur={() => onOpenChange(false)}\n />\n )\n}\n\nexport { AutoCompleteInput }\n"],"names":["AutoCompleteInput","props","value","onValueChange","onOpenChange","inputRef","useAutoCompleteContext","CommandInput"],"mappings":"gHAKA,SAASA,EACPC,CAAoD,EAEpD,GAAM,CAAEC,MAAAA,CAAK,CAAEC,cAAAA,CAAa,CAAEC,aAAAA,CAAY,CAAEC,SAAAA,CAAQ,CAAE,CACpDC,AAAAA,GAAAA,EAAAA,sBAAAA,AAAAA,IAOF,MACE,UAACC,EAAAA,YAAYA,CAAAA,CACV,GAAGN,CAAK,CACT,IAAKI,EACL,MAAOH,EACP,cAVJ,SAAsBA,CAAa,EACjCC,IAAgBD,GAChBD,EAAM,aAAa,GAAGC,EACxB,EAQI,QAAS,IAAME,EAAa,IAC5B,OAAQ,IAAMA,EAAa,G,EAGjC,Q"}
1
+ {"version":3,"file":"components\\autocomplete\\autocomplete-input.js","sources":["webpack://@gbmtech/aurora-ui/./src/components/autocomplete/autocomplete-input.tsx"],"sourcesContent":["import type { ComponentPropsWithoutRef } from 'react'\n\nimport { CommandInput } from '../command'\nimport { useAutoCompleteContext } from './autocomplete-context'\n\nfunction AutoCompleteInput(\n props: ComponentPropsWithoutRef<typeof CommandInput>\n) {\n const { value, onValueChange, onOpenChange, inputRef } =\n useAutoCompleteContext()\n\n function handleChange(value: string) {\n onValueChange?.(value)\n props.onValueChange?.(value)\n }\n\n return (\n <CommandInput\n {...props}\n ref={inputRef}\n value={props.value || value}\n onValueChange={handleChange}\n onFocus={() => onOpenChange(true)}\n onBlur={() => onOpenChange(false)}\n />\n )\n}\n\nexport { AutoCompleteInput }\n"],"names":["AutoCompleteInput","props","value","onValueChange","onOpenChange","inputRef","useAutoCompleteContext","CommandInput"],"mappings":"gHAKA,SAASA,EACPC,CAAoD,EAEpD,GAAM,CAAEC,MAAAA,CAAK,CAAEC,cAAAA,CAAa,CAAEC,aAAAA,CAAY,CAAEC,SAAAA,CAAQ,CAAE,CACpDC,AAAAA,GAAAA,EAAAA,sBAAAA,AAAAA,IAOF,MACE,UAACC,EAAAA,YAAYA,CAAAA,CACV,GAAGN,CAAK,CACT,IAAKI,EACL,MAAOJ,EAAM,KAAK,EAAIC,EACtB,cAVJ,SAAsBA,CAAa,EACjCC,IAAgBD,GAChBD,EAAM,aAAa,GAAGC,EACxB,EAQI,QAAS,IAAME,EAAa,IAC5B,OAAQ,IAAMA,EAAa,G,EAGjC,Q"}
@@ -1 +1 @@
1
- import*as t from"./data-table-date-filter.js";import*as a from"./data-table-faceted-filter.js";import*as e from"./data-table-range-filter.js";import*as r from"./data-table-slider-filter.js";import*as o from"./data-table-view-options.js";export*from"./data-table-action-bar.js";export*from"./data-table-advanced-toolbar.js";export*from"./data-table-column-header.js";export*from"./data-table-filter-list.js";export*from"./data-table-filter-menu.js";export*from"./data-table-pagination.js";export*from"./data-table-skeleton.js";export*from"./data-table-sort-list.js";export*from"./data-table-toolbar.js";export*from"./data-table.js";var n={"@/components/data-table/data-table-date-filter":function(a){a.exports=t},"@/components/data-table/data-table-faceted-filter":function(t){t.exports=a},"@/components/data-table/data-table-range-filter":function(t){t.exports=e},"@/components/data-table/data-table-slider-filter":function(t){t.exports=r},"@/components/data-table/data-table-view-options":function(t){t.exports=o}},l={};function d(t){var a=l[t];if(void 0!==a)return a.exports;var e=l[t]={exports:{}};return n[t](e,e.exports,d),e.exports}d.d=(t,a)=>{for(var e in a)d.o(a,e)&&!d.o(t,e)&&Object.defineProperty(t,e,{enumerable:!0,get:a[e]})},d.o=(t,a)=>Object.prototype.hasOwnProperty.call(t,a),d.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var i={};d.r(i);var f=d("@/components/data-table/data-table-date-filter"),b={};for(var s in f)"default"!==s&&(b[s]=(function(t){return f[t]}).bind(0,s));d.d(i,b);var p=d("@/components/data-table/data-table-faceted-filter"),b={};for(var s in p)"default"!==s&&(b[s]=(function(t){return p[t]}).bind(0,s));d.d(i,b);var m=d("@/components/data-table/data-table-range-filter"),b={};for(var s in m)"default"!==s&&(b[s]=(function(t){return m[t]}).bind(0,s));d.d(i,b);var c=d("@/components/data-table/data-table-slider-filter"),b={};for(var s in c)"default"!==s&&(b[s]=(function(t){return c[t]}).bind(0,s));d.d(i,b);var u=d("@/components/data-table/data-table-view-options"),b={};for(var s in u)"default"!==s&&(b[s]=(function(t){return u[t]}).bind(0,s));d.d(i,b);
1
+ import*as t from"./data-table-date-filter.js";import*as a from"./data-table-faceted-filter.js";import*as e from"./data-table-pagination.js";import*as o from"./data-table-slider-filter.js";import*as r from"./data-table-view-options.js";export*from"./data-table-action-bar.js";export*from"./data-table-advanced-toolbar.js";export*from"./data-table-column-header.js";export*from"./data-table-filter-list.js";export*from"./data-table-filter-menu.js";export*from"./data-table-range-filter.js";export*from"./data-table-skeleton.js";export*from"./data-table-sort-list.js";export*from"./data-table-toolbar.js";export*from"./data-table.js";var n={"@/components/data-table/data-table-date-filter":function(a){a.exports=t},"@/components/data-table/data-table-faceted-filter":function(t){t.exports=a},"@/components/data-table/data-table-pagination":function(t){t.exports=e},"@/components/data-table/data-table-slider-filter":function(t){t.exports=o},"@/components/data-table/data-table-view-options":function(t){t.exports=r}},d={};function l(t){var a=d[t];if(void 0!==a)return a.exports;var e=d[t]={exports:{}};return n[t](e,e.exports,l),e.exports}l.d=(t,a)=>{for(var e in a)l.o(a,e)&&!l.o(t,e)&&Object.defineProperty(t,e,{enumerable:!0,get:a[e]})},l.o=(t,a)=>Object.prototype.hasOwnProperty.call(t,a),l.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var i={};l.r(i);var f=l("@/components/data-table/data-table-date-filter"),b={};for(var s in f)"default"!==s&&(b[s]=(function(t){return f[t]}).bind(0,s));l.d(i,b);var p=l("@/components/data-table/data-table-faceted-filter"),b={};for(var s in p)"default"!==s&&(b[s]=(function(t){return p[t]}).bind(0,s));l.d(i,b);var m=l("@/components/data-table/data-table-pagination"),b={};for(var s in m)"default"!==s&&(b[s]=(function(t){return m[t]}).bind(0,s));l.d(i,b);var c=l("@/components/data-table/data-table-slider-filter"),b={};for(var s in c)"default"!==s&&(b[s]=(function(t){return c[t]}).bind(0,s));l.d(i,b);var u=l("@/components/data-table/data-table-view-options"),b={};for(var s in u)"default"!==s&&(b[s]=(function(t){return u[t]}).bind(0,s));l.d(i,b);
@@ -1,8 +1,8 @@
1
1
  import type { Scope } from '@radix-ui/react-context';
2
- import type * as LabelPrimitive from '@radix-ui/react-label';
3
2
  import type { ComponentProps, JSX, ReactNode } from 'react';
4
3
  import type { ControllerProps, FieldPath, FieldValues } from 'react-hook-form';
5
4
  import { Slot } from '@radix-ui/react-slot';
5
+ import { Label } from './label';
6
6
  declare const Form: <TFieldValues extends FieldValues, TContext = any, TTransformedValues = TFieldValues>(props: import("react-hook-form").FormProviderProps<TFieldValues, TContext, TTransformedValues>) => React.JSX.Element;
7
7
  type ScopedProps<P> = P & {
8
8
  __scopeFormField?: Scope;
@@ -10,7 +10,7 @@ type ScopedProps<P> = P & {
10
10
  declare const createFormFieldScope: import("@radix-ui/react-context").CreateScope;
11
11
  declare function FormField<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>(formFieldProps: ScopedProps<ControllerProps<TFieldValues, TName>>): JSX.Element;
12
12
  declare function FormItem({ __scopeFormField, className, ...props }: ScopedProps<ComponentProps<'div'>>): JSX.Element;
13
- declare function FormLabel({ __scopeFormField, ...props }: ScopedProps<ComponentProps<typeof LabelPrimitive.Root>>): JSX.Element;
13
+ declare function FormLabel({ __scopeFormField, ...props }: ScopedProps<ComponentProps<typeof Label>>): JSX.Element;
14
14
  declare function FormControl({ __scopeFormField, ...props }: ScopedProps<ComponentProps<typeof Slot>>): JSX.Element;
15
15
  declare function FormDescription({ __scopeFormField, className, ...props }: ScopedProps<ComponentProps<'p'>>): JSX.Element;
16
16
  declare function FormMessage({ __scopeFormField, children, className, ...props }: ScopedProps<ComponentProps<'p'>>): ReactNode;
@@ -1 +1 @@
1
- {"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../../../src/components/form.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AACpD,OAAO,KAAK,KAAK,cAAc,MAAM,uBAAuB,CAAA;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAC3D,OAAO,KAAK,EACV,eAAe,EAEf,SAAS,EACT,WAAW,EAC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AG,CAAC,OAAO,CAWzD;AAQD,iBAAS,WAAW,CAAC,EACnB,gBAAgB,EAChB,GAAG,KAAK,EACT,EAAE,WAAW,CAAC,cAAc,CAAC,OAAO,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC,OAAO,CAiBxD;AAMD,iBAAS,eAAe,CAAC,EACvB,gBAAgB,EAChB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,WAAW,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,OAAO,CAWhD;AAQD,iBAAS,WAAW,CAAC,EACnB,gBAAgB,EAChB,QAAQ,EACR,SAAS,EACT,GAAG,KAAK,EACT,EAAE,WAAW,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,GAAG,SAAS,CAyB9C;AAMD,OAAO,EACL,oBAAoB,EACpB,IAAI,EACJ,WAAW,EACX,eAAe,EACf,SAAS,EACT,QAAQ,EACR,SAAS,EACT,WAAW,GACZ,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"components\\form.js","sources":["webpack://@gbmtech/aurora-ui/./src/components/form.tsx"],"sourcesContent":["\r\n\r\nimport type { Scope } from '@radix-ui/react-context'\r\nimport type * as LabelPrimitive from '@radix-ui/react-label'\r\nimport type { ComponentProps, JSX, ReactNode } from 'react'\r\nimport type {\r\n ControllerProps,\r\n FieldError,\r\n FieldPath,\r\n FieldValues,\r\n} from 'react-hook-form'\r\n\r\nimport { createContextScope } from '@radix-ui/react-context'\r\nimport { Slot } from '@radix-ui/react-slot'\r\nimport { useId } from 'react'\r\nimport {\r\n Controller,\r\n FormProvider,\r\n useFormContext,\r\n useFormState,\r\n} from 'react-hook-form'\r\n\r\nimport { Label } from '@/components/label'\r\nimport { cn } from '@/lib/utils'\r\n\r\n/* -----------------------------------------------------------------------------\r\n * Component: Form\r\n * -------------------------------------------------------------------------- */\r\n\r\nconst Form = FormProvider\r\n\r\n/* -----------------------------------------------------------------------------\r\n * Context: FormField\r\n * -------------------------------------------------------------------------- */\r\n\r\nconst FORM_FIELD_NAME = 'FormField'\r\n\r\ntype ScopedProps<P> = P & { __scopeFormField?: Scope }\r\n\r\nconst [createFormFieldContext, createFormFieldScope] =\r\n createContextScope(FORM_FIELD_NAME)\r\n\r\ninterface FormFieldContextValue<\r\n TFieldValues extends FieldValues = FieldValues,\r\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\r\n> {\r\n name: TName\r\n}\r\n\r\nconst [FormFieldContextProvider, useFormFieldContext] =\r\n createFormFieldContext<FormFieldContextValue>(FORM_FIELD_NAME)\r\n\r\nfunction useFormItem(\r\n consumerName: string,\r\n scope: Scope\r\n): {\r\n formDescriptionId: string\r\n formItemId: string\r\n formMessageId: string\r\n id: string\r\n invalid: boolean\r\n isDirty: boolean\r\n isTouched: boolean\r\n isValidating: boolean\r\n name: string\r\n error?: FieldError\r\n} {\r\n const { id } = useFormItemContext(consumerName, scope)\r\n const { name } = useFormFieldContext(consumerName, scope)\r\n const { getFieldState } = useFormContext()\r\n const formState = useFormState({ name })\r\n const fieldState = getFieldState(name, formState)\r\n\r\n return {\r\n id,\r\n name,\r\n formDescriptionId: `form-item-description-${id}`,\r\n formItemId: `form-item-${id}`,\r\n formMessageId: `form-item-message-${id}`,\r\n ...fieldState,\r\n }\r\n}\r\n\r\n/* -----------------------------------------------------------------------------\r\n * Component: FormField\r\n * -------------------------------------------------------------------------- */\r\n\r\nfunction FormField<\r\n TFieldValues extends FieldValues = FieldValues,\r\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\r\n>(\r\n formFieldProps: ScopedProps<ControllerProps<TFieldValues, TName>>\r\n): JSX.Element {\r\n const { __scopeFormField, ...props } = formFieldProps\r\n\r\n return (\r\n <FormFieldContextProvider name={props.name} scope={__scopeFormField}>\r\n <Controller {...props} />\r\n </FormFieldContextProvider>\r\n )\r\n}\r\n\r\n/* -----------------------------------------------------------------------------\r\n * Context: FormItem\r\n * -------------------------------------------------------------------------- */\r\n\r\nconst FORM_ITEM_NAME = 'FormItem'\r\n\r\ninterface FormItemContextValue {\r\n id: string\r\n}\r\n\r\nconst [FormItemContextProvider, useFormItemContext] =\r\n createFormFieldContext<FormItemContextValue>(FORM_ITEM_NAME)\r\n\r\n/* -----------------------------------------------------------------------------\r\n * Component: FormItem\r\n * -------------------------------------------------------------------------- */\r\n\r\nfunction FormItem({\r\n __scopeFormField,\r\n className,\r\n ...props\r\n}: ScopedProps<ComponentProps<'div'>>): JSX.Element {\r\n const id = useId()\r\n\r\n return (\r\n <FormItemContextProvider id={id} scope={__scopeFormField}>\r\n <div\r\n className={cn('space-y-2', className)}\r\n data-slot=\"form-item\"\r\n {...props}\r\n />\r\n </FormItemContextProvider>\r\n )\r\n}\r\n\r\n/* -----------------------------------------------------------------------------\r\n * Component: FormLabel\r\n * -------------------------------------------------------------------------- */\r\n\r\nconst FORM_LABEL_NAME = 'FormLabel'\r\n\r\nfunction FormLabel({\r\n __scopeFormField,\r\n ...props\r\n}: ScopedProps<ComponentProps<typeof LabelPrimitive.Root>>): JSX.Element {\r\n const { formItemId, error } = useFormItem(FORM_LABEL_NAME, __scopeFormField)\r\n\r\n return (\r\n <Label\r\n data-invalid={error ? true : undefined}\r\n data-slot=\"form-label\"\r\n htmlFor={formItemId}\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\n/* -----------------------------------------------------------------------------\r\n * Component: FormControl\r\n * -------------------------------------------------------------------------- */\r\n\r\nconst FORM_CONTROL_NAME = 'FormControl'\r\n\r\nfunction FormControl({\r\n __scopeFormField,\r\n ...props\r\n}: ScopedProps<ComponentProps<typeof Slot>>): JSX.Element {\r\n const { formDescriptionId, formItemId, formMessageId, error } = useFormItem(\r\n FORM_CONTROL_NAME,\r\n __scopeFormField\r\n )\r\n\r\n return (\r\n <Slot\r\n aria-describedby={\r\n error ? `${formDescriptionId} ${formMessageId}` : formDescriptionId\r\n }\r\n aria-invalid={Boolean(error)}\r\n data-slot=\"form-control\"\r\n id={formItemId}\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\n/* -----------------------------------------------------------------------------\r\n * Component: FormDescription\r\n * -------------------------------------------------------------------------- */\r\n\r\nfunction FormDescription({\r\n __scopeFormField,\r\n className,\r\n ...props\r\n}: ScopedProps<ComponentProps<'p'>>): JSX.Element {\r\n const { formDescriptionId } = useFormItem(FORM_MESSAGE_NAME, __scopeFormField)\r\n\r\n return (\r\n <p\r\n className={cn('text-muted-foreground text-xs', className)}\r\n data-slot=\"form-description\"\r\n id={formDescriptionId}\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\n/* -----------------------------------------------------------------------------\r\n * Component: FormMessage\r\n * -------------------------------------------------------------------------- */\r\n\r\nconst FORM_MESSAGE_NAME = 'FormMessage'\r\n\r\nfunction FormMessage({\r\n __scopeFormField,\r\n children,\r\n className,\r\n ...props\r\n}: ScopedProps<ComponentProps<'p'>>): ReactNode {\r\n const { formMessageId, error } = useFormItem(\r\n FORM_MESSAGE_NAME,\r\n __scopeFormField\r\n )\r\n const body = error?.message ? String(error.message) : children\r\n\r\n if (!body) {\r\n return null\r\n }\r\n\r\n return (\r\n <p\r\n className={cn(\r\n 'text-xs',\r\n error?.message ? 'font-medium text-error' : 'text-gray-600',\r\n className\r\n )}\r\n data-slot=\"form-message\"\r\n id={formMessageId}\r\n {...props}\r\n >\r\n {body}\r\n </p>\r\n )\r\n}\r\n\r\n/* -----------------------------------------------------------------------------\r\n * Exports\r\n * -------------------------------------------------------------------------- */\r\n\r\nexport {\r\n createFormFieldScope,\r\n Form,\r\n FormControl,\r\n FormDescription,\r\n FormField,\r\n FormItem,\r\n FormLabel,\r\n FormMessage,\r\n}\r\n"],"names":["Form","FormProvider","FORM_FIELD_NAME","createFormFieldContext","createFormFieldScope","createContextScope","FormFieldContextProvider","useFormFieldContext","useFormItem","consumerName","scope","id","useFormItemContext","name","getFieldState","useFormContext","formState","useFormState","fieldState","FormField","formFieldProps","__scopeFormField","props","Controller","FormItemContextProvider","FormItem","className","useId","cn","FormLabel","formItemId","error","Label","undefined","FormControl","formDescriptionId","formMessageId","Slot","Boolean","FormDescription","FORM_MESSAGE_NAME","FormMessage","children","body","String"],"mappings":";8OA6BA,IAAMA,EAAOC,EAAAA,YAAYA,CAMnBC,EAAkB,YAIlB,CAACC,EAAwBC,EAAqB,CAClDC,GAAAA,EAAAA,kBAAAA,EAAmBH,GASf,CAACI,EAA0BC,EAAoB,CACnDJ,EAA8CD,GAEhD,SAASM,EACPC,CAAoB,CACpBC,CAAY,EAaZ,GAAM,CAAEC,GAAAA,CAAE,CAAE,CAAGC,EAAmBH,EAAcC,GAC1C,CAAEG,KAAAA,CAAI,CAAE,CAAGN,EAAoBE,EAAcC,GAC7C,CAAEI,cAAAA,CAAa,CAAE,CAAGC,GAAAA,EAAAA,cAAAA,IACpBC,EAAYC,GAAAA,EAAAA,YAAAA,EAAa,CAAEJ,KAAAA,CAAK,GAChCK,EAAaJ,EAAcD,EAAMG,GAEvC,MAAO,CACLL,GAAAA,EACAE,KAAAA,EACA,kBAAmB,CAAC,sBAAsB,EAAEF,EAAG,CAAC,CAChD,WAAY,CAAC,UAAU,EAAEA,EAAG,CAAC,CAC7B,cAAe,CAAC,kBAAkB,EAAEA,EAAG,CAAC,CACxC,GAAGO,CAAU,CAEjB,CAMA,SAASC,EAIPC,CAAiE,EAEjE,GAAM,CAAEC,iBAAAA,CAAgB,CAAE,GAAGC,EAAO,CAAGF,EAEvC,MACE,UAACd,EAAAA,CAAyB,KAAMgB,EAAM,IAAI,CAAE,MAAOD,E,SACjD,UAACE,EAAAA,UAAUA,CAAAA,CAAE,GAAGD,CAAK,IAG3B,CAYA,GAAM,CAACE,EAAyBZ,EAAmB,CACjDT,EAPqB,YAavB,SAASsB,EAAS,CAChBJ,iBAAAA,CAAgB,CAChBK,UAAAA,CAAS,CACT,GAAGJ,EACgC,EACnC,IAAMX,EAAKgB,GAAAA,EAAAA,KAAAA,IAEX,MACE,UAACH,EAAAA,CAAwB,GAAIb,EAAI,MAAOU,E,SACtC,UAAC,OACC,U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OAAOb,EAAM,OAAO,EAAIW,SAEtD,EAKE,UAAC,KACC,UAAWd,GAAAA,EAAAA,EAAAA,EACT,UACAG,GAAO,QAAU,yBAA2B,gBAC5CL,GAEF,YAAU,eACV,GAAIU,EACH,GAAGd,CAAK,C,SAERqB,C,GAdI,IAiBX,Q"}
1
+ {"version":3,"file":"components\\form.js","sources":["webpack://@gbmtech/aurora-ui/./src/components/form.tsx"],"sourcesContent":["\r\n\r\nimport type { Scope } from '@radix-ui/react-context'\r\nimport type { ComponentProps, JSX, ReactNode } from 'react'\r\nimport type {\r\n ControllerProps,\r\n FieldError,\r\n FieldPath,\r\n FieldValues,\r\n} from 'react-hook-form'\r\n\r\nimport { createContextScope } from '@radix-ui/react-context'\r\nimport { Slot } from '@radix-ui/react-slot'\r\nimport { useId } from 'react'\r\nimport {\r\n Controller,\r\n FormProvider,\r\n useFormContext,\r\n useFormState,\r\n} from 'react-hook-form'\r\n\r\nimport { Label } from '@/components/label'\r\nimport { cn } from '@/lib/utils'\r\n\r\n/* -----------------------------------------------------------------------------\r\n * Component: Form\r\n * -------------------------------------------------------------------------- */\r\n\r\nconst Form = FormProvider\r\n\r\n/* -----------------------------------------------------------------------------\r\n * Context: FormField\r\n * -------------------------------------------------------------------------- */\r\n\r\nconst FORM_FIELD_NAME = 'FormField'\r\n\r\ntype ScopedProps<P> = P & { __scopeFormField?: Scope }\r\n\r\nconst [createFormFieldContext, createFormFieldScope] =\r\n createContextScope(FORM_FIELD_NAME)\r\n\r\ninterface FormFieldContextValue<\r\n TFieldValues extends FieldValues = FieldValues,\r\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\r\n> {\r\n name: TName\r\n}\r\n\r\nconst [FormFieldContextProvider, useFormFieldContext] =\r\n createFormFieldContext<FormFieldContextValue>(FORM_FIELD_NAME)\r\n\r\nfunction useFormItem(\r\n consumerName: string,\r\n scope: Scope\r\n): {\r\n formDescriptionId: string\r\n formItemId: string\r\n formMessageId: string\r\n id: string\r\n invalid: boolean\r\n isDirty: boolean\r\n isTouched: boolean\r\n isValidating: boolean\r\n name: string\r\n error?: FieldError\r\n} {\r\n const { id } = useFormItemContext(consumerName, scope)\r\n const { name } = useFormFieldContext(consumerName, scope)\r\n const { getFieldState } = useFormContext()\r\n const formState = useFormState({ name })\r\n const fieldState = getFieldState(name, formState)\r\n\r\n return {\r\n id,\r\n name,\r\n formDescriptionId: `form-item-description-${id}`,\r\n formItemId: `form-item-${id}`,\r\n formMessageId: `form-item-message-${id}`,\r\n ...fieldState,\r\n }\r\n}\r\n\r\n/* -----------------------------------------------------------------------------\r\n * Component: FormField\r\n * -------------------------------------------------------------------------- */\r\n\r\nfunction FormField<\r\n TFieldValues extends FieldValues = FieldValues,\r\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\r\n>(\r\n formFieldProps: ScopedProps<ControllerProps<TFieldValues, TName>>\r\n): JSX.Element {\r\n const { __scopeFormField, ...props } = formFieldProps\r\n\r\n return (\r\n <FormFieldContextProvider name={props.name} scope={__scopeFormField}>\r\n <Controller {...props} />\r\n </FormFieldContextProvider>\r\n )\r\n}\r\n\r\n/* -----------------------------------------------------------------------------\r\n * Context: FormItem\r\n * -------------------------------------------------------------------------- */\r\n\r\nconst FORM_ITEM_NAME = 'FormItem'\r\n\r\ninterface FormItemContextValue {\r\n id: string\r\n}\r\n\r\nconst [FormItemContextProvider, useFormItemContext] =\r\n createFormFieldContext<FormItemContextValue>(FORM_ITEM_NAME)\r\n\r\n/* -----------------------------------------------------------------------------\r\n * Component: FormItem\r\n * -------------------------------------------------------------------------- */\r\n\r\nfunction FormItem({\r\n __scopeFormField,\r\n className,\r\n ...props\r\n}: ScopedProps<ComponentProps<'div'>>): JSX.Element {\r\n const id = useId()\r\n\r\n return (\r\n <FormItemContextProvider id={id} scope={__scopeFormField}>\r\n <div\r\n className={cn('space-y-2', className)}\r\n data-slot=\"form-item\"\r\n {...props}\r\n />\r\n </FormItemContextProvider>\r\n )\r\n}\r\n\r\n/* -----------------------------------------------------------------------------\r\n * Component: FormLabel\r\n * -------------------------------------------------------------------------- */\r\n\r\nconst FORM_LABEL_NAME = 'FormLabel'\r\n\r\nfunction FormLabel({\r\n __scopeFormField,\r\n ...props\r\n}: ScopedProps<ComponentProps<typeof Label>>): JSX.Element {\r\n const { formItemId, error } = useFormItem(FORM_LABEL_NAME, __scopeFormField)\r\n\r\n return (\r\n <Label\r\n data-invalid={error ? true : undefined}\r\n data-slot=\"form-label\"\r\n htmlFor={formItemId}\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\n/* -----------------------------------------------------------------------------\r\n * Component: FormControl\r\n * -------------------------------------------------------------------------- */\r\n\r\nconst FORM_CONTROL_NAME = 'FormControl'\r\n\r\nfunction FormControl({\r\n __scopeFormField,\r\n ...props\r\n}: ScopedProps<ComponentProps<typeof Slot>>): JSX.Element {\r\n const { formDescriptionId, formItemId, formMessageId, error } = useFormItem(\r\n FORM_CONTROL_NAME,\r\n __scopeFormField\r\n )\r\n\r\n return (\r\n <Slot\r\n aria-describedby={\r\n error ? `${formDescriptionId} ${formMessageId}` : formDescriptionId\r\n }\r\n aria-invalid={Boolean(error)}\r\n data-slot=\"form-control\"\r\n id={formItemId}\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\n/* -----------------------------------------------------------------------------\r\n * Component: FormDescription\r\n * -------------------------------------------------------------------------- */\r\n\r\nfunction FormDescription({\r\n __scopeFormField,\r\n className,\r\n ...props\r\n}: ScopedProps<ComponentProps<'p'>>): JSX.Element {\r\n const { formDescriptionId } = useFormItem(FORM_MESSAGE_NAME, __scopeFormField)\r\n\r\n return (\r\n <p\r\n className={cn('text-muted-foreground text-xs', className)}\r\n data-slot=\"form-description\"\r\n id={formDescriptionId}\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\n/* -----------------------------------------------------------------------------\r\n * Component: FormMessage\r\n * -------------------------------------------------------------------------- */\r\n\r\nconst FORM_MESSAGE_NAME = 'FormMessage'\r\n\r\nfunction FormMessage({\r\n __scopeFormField,\r\n children,\r\n className,\r\n ...props\r\n}: ScopedProps<ComponentProps<'p'>>): ReactNode {\r\n const { formMessageId, error } = useFormItem(\r\n FORM_MESSAGE_NAME,\r\n __scopeFormField\r\n )\r\n const body = error?.message ? String(error.message) : children\r\n\r\n if (!body) {\r\n return null\r\n }\r\n\r\n return (\r\n <p\r\n className={cn(\r\n 'text-xs',\r\n error?.message ? 'font-medium text-error' : 'text-gray-600',\r\n className\r\n )}\r\n data-slot=\"form-message\"\r\n id={formMessageId}\r\n {...props}\r\n >\r\n {body}\r\n </p>\r\n )\r\n}\r\n\r\n/* -----------------------------------------------------------------------------\r\n * Exports\r\n * -------------------------------------------------------------------------- */\r\n\r\nexport {\r\n createFormFieldScope,\r\n Form,\r\n FormControl,\r\n FormDescription,\r\n FormField,\r\n FormItem,\r\n FormLabel,\r\n FormMessage,\r\n}\r\n"],"names":["Form","FormProvider","FORM_FIELD_NAME","createFormFieldContext","createFormFieldScope","createContextScope","FormFieldContextProvider","useFormFieldContext","useFormItem","consumerName","scope","id","useFormItemContext","name","getFieldState","useFormContext","formState","useFormState","fieldState","FormField","formFieldProps","__scopeFormField","props","Controller","FormItemContextProvider","FormItem","className","useId","cn","FormLabel","formItemId","error","Label","undefined","FormControl","formDescriptionId","formMessageId","Slot","Boolean","FormDescription","FORM_MESSAGE_NAME","FormMessage","children","body","String"],"mappings":";8OA4BA,IAAMA,EAAOC,EAAAA,YAAYA,CAMnBC,EAAkB,YAIlB,CAACC,EAAwBC,EAAqB,CAClDC,GAAAA,EAAAA,kBAAAA,EAAmBH,GASf,CAACI,EAA0BC,EAAoB,CACnDJ,EAA8CD,GAEhD,SAASM,EACPC,CAAoB,CACpBC,CAAY,EAaZ,GAAM,CAAEC,GAAAA,CAAE,CAAE,CAAGC,EAAmBH,EAAcC,GAC1C,CAAEG,KAAAA,CAAI,CAAE,CAAGN,EAAoBE,EAAcC,GAC7C,CAAEI,cAAAA,CAAa,CAAE,CAAGC,GAAAA,EAAAA,cA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AEM,cAAAA,CAAa,CAAEL,MAAAA,CAAK,CAAE,CAAGvB,EANxC,cAQtBa,GAGF,MACE,UAACgB,EAAAA,IAAIA,CAAAA,CACH,mBACEN,EAAQ,CAAC,EAAEI,EAAkB,CAAC,EAAEC,EAAc,CAAC,CAAGD,EAEpD,eAAcG,CAAAA,CAAQP,EACtB,YAAU,eACV,GAAID,EACH,GAAGR,CAAK,EAGf,CAMA,SAASiB,EAAgB,CACvBlB,iBAAAA,CAAgB,CAChBK,UAAAA,CAAS,CACT,GAAGJ,EAC8B,EACjC,GAAM,CAAEa,kBAAAA,CAAiB,CAAE,CAAG3B,EAAYgC,EAAmBnB,GAE7D,MACE,UAAC,KACC,UAAWO,GAAAA,EAAAA,EAAAA,EAAG,gCAAiCF,GAC/C,YAAU,mBACV,GAAIS,EACH,GAAGb,CAAK,EAGf,CAMA,IAAMkB,EAAoB,cAE1B,SAASC,EAAY,CACnBpB,iBAAAA,CAAgB,CAChBqB,SAAAA,CAAQ,CACRhB,UAAAA,CAAS,CACT,GAAGJ,EAC8B,EACjC,GAAM,CAAEc,cAAAA,CAAa,CAAEL,MAAAA,CAAK,CAAE,CAAGvB,EAC/BgC,EACAnB,GAEIsB,EAAOZ,GAAO,QAAUa,OAAOb,EAAM,OAAO,EAAIW,SAEtD,EAKE,UAAC,KACC,UAAWd,GAAAA,EAAAA,EAAAA,EACT,UACAG,GAAO,QAAU,yBAA2B,gBAC5CL,GAEF,YAAU,eACV,GAAIU,EACH,GAAGd,CAAK,C,SAERqB,C,GAdI,IAiBX,Q"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gbmtech/aurora-ui",
3
- "version": "0.2.49",
3
+ "version": "0.2.51",
4
4
  "main": "./dist/cjs/index.cjs",
5
5
  "module": "./dist/esm/index.js",
6
6
  "types": "./dist/types/index.d.ts",