@daren/form-elements
Advanced tools
Comparing version 1.0.0 to 1.1.0
"use strict"; | ||
exports.__esModule = true; | ||
exports.Field = void 0; | ||
exports.Field = exports.DropdownField = void 0; | ||
var _utils = require("@daren/utils"); | ||
var React = _interopRequireWildcard(require("react")); | ||
var _dropdown = require("./dropdown"); | ||
var _input = require("./input"); | ||
@@ -12,3 +16,4 @@ | ||
var _excluded = ["defaultValue", "error", "name", "label", "className", "description", "id", "inputClass"]; | ||
var _excluded = ["defaultValue", "error", "name", "label", "className", "description", "id", "inputClass"], | ||
_excluded2 = ["error", "name", "label", "description", "id", "className", "defaultValue", "items", "inputClass"]; | ||
@@ -23,18 +28,79 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
var Field = /*#__PURE__*/React.forwardRef(function Field(_ref, ref) { | ||
var defaultValue = _ref.defaultValue, | ||
error = _ref.error, | ||
name = _ref.name, | ||
label = _ref.label, | ||
function FieldWrapper(_ref) { | ||
var children = _ref.children, | ||
className = _ref.className, | ||
description = _ref.description, | ||
id = _ref.id, | ||
inputClass = _ref.inputClass, | ||
props = _objectWithoutPropertiesLoose(_ref, _excluded); | ||
descriptionId = _ref.descriptionId, | ||
error = _ref.error, | ||
errorId = _ref.errorId, | ||
inputId = _ref.inputId, | ||
label = _ref.label; | ||
return /*#__PURE__*/React.createElement("div", { | ||
className: className | ||
}, /*#__PURE__*/React.createElement("div", { | ||
className: "flex justify-between" | ||
}, /*#__PURE__*/React.createElement(_misc.Label, { | ||
htmlFor: inputId, | ||
className: "mb-2" | ||
}, label), description && /*#__PURE__*/React.createElement("span", { | ||
className: "text-sm text-slate-400", | ||
id: descriptionId | ||
}, description)), children, error && /*#__PURE__*/React.createElement("p", { | ||
className: "mt-2 text-sm text-red-600", | ||
id: errorId | ||
}, error)); | ||
} | ||
var Field = /*#__PURE__*/React.forwardRef(function Field(_ref2, ref) { | ||
var defaultValue = _ref2.defaultValue, | ||
error = _ref2.error, | ||
name = _ref2.name, | ||
label = _ref2.label, | ||
className = _ref2.className, | ||
description = _ref2.description, | ||
id = _ref2.id, | ||
inputClass = _ref2.inputClass, | ||
props = _objectWithoutPropertiesLoose(_ref2, _excluded); | ||
var inputId = id != null ? id : name; | ||
var errorId = inputId + "-error"; | ||
var descriptionId = inputId + "-description"; | ||
return /*#__PURE__*/React.createElement(FieldWrapper, { | ||
descriptionId: descriptionId, | ||
errorId: errorId, | ||
inputId: inputId, | ||
className: className, | ||
label: label, | ||
error: error, | ||
description: description | ||
}, /*#__PURE__*/React.createElement(_input.Input, _extends({ | ||
hasError: !!error, | ||
className: inputClass | ||
}, props, { | ||
ref: ref, | ||
name: name, | ||
id: inputId, | ||
autoComplete: name, | ||
defaultValue: defaultValue, | ||
"aria-describedby": error ? errorId : description ? descriptionId : undefined | ||
}))); | ||
}); | ||
exports.Field = Field; | ||
var DropdownField = /*#__PURE__*/React.forwardRef(function DropdownField(_ref3, ref) { | ||
var error = _ref3.error, | ||
name = _ref3.name, | ||
label = _ref3.label, | ||
description = _ref3.description, | ||
id = _ref3.id, | ||
className = _ref3.className, | ||
defaultValue = _ref3.defaultValue, | ||
items = _ref3.items, | ||
inputClass = _ref3.inputClass, | ||
props = _objectWithoutPropertiesLoose(_ref3, _excluded2); | ||
var inputId = id != null ? id : name; | ||
var errorId = inputId + "-error"; | ||
var descriptionId = inputId + "-description"; | ||
return /*#__PURE__*/React.createElement("div", { | ||
className: className | ||
className: (0, _utils.cx)(className, 'w-full') | ||
}, /*#__PURE__*/React.createElement("div", { | ||
@@ -48,3 +114,3 @@ className: "flex justify-between" | ||
id: descriptionId | ||
}, description)), /*#__PURE__*/React.createElement(_input.Input, _extends({ | ||
}, description)), /*#__PURE__*/React.createElement(_dropdown.Dropdown, _extends({ | ||
hasError: !!error, | ||
@@ -56,5 +122,4 @@ className: inputClass | ||
id: inputId, | ||
autoComplete: name, | ||
required: true, | ||
defaultValue: defaultValue, | ||
items: items, | ||
"aria-describedby": error ? errorId : description ? descriptionId : undefined | ||
@@ -66,3 +131,3 @@ })), error && /*#__PURE__*/React.createElement("p", { | ||
}); | ||
exports.Field = Field; | ||
exports.DropdownField = DropdownField; | ||
//# sourceMappingURL=field.js.map |
@@ -5,2 +5,10 @@ "use strict"; | ||
var _dropdown = require("./dropdown"); | ||
Object.keys(_dropdown).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
if (key in exports && exports[key] === _dropdown[key]) return; | ||
exports[key] = _dropdown[key]; | ||
}); | ||
var _field = require("./field"); | ||
@@ -7,0 +15,0 @@ |
@@ -12,2 +12,4 @@ "use strict"; | ||
var _utils2 = require("./utils"); | ||
var _excluded = ["type", "hasError"]; | ||
@@ -28,6 +30,3 @@ | ||
var className = (0, _utils.cx)(hasError ? 'border-red-300 border hover:border-transparent' : 'border-none', 'py-5 px-8 pr-10 w-full text-md font-bold placeholder:text-gray-500 disabled:text-gray-400 rounded-lg focus-ring', { | ||
'bg-primary-600 text-slate-900': !hasError, | ||
'!text-danger bg-primary-600 animate-shake !set-colors-accent-danger': hasError | ||
}, props.className); | ||
var className = (0, _utils2.getInputClassName)(props.className, hasError); | ||
@@ -34,0 +33,0 @@ if (type === 'textarea') { |
@@ -1,2 +0,3 @@ | ||
var _excluded = ["defaultValue", "error", "name", "label", "className", "description", "id", "inputClass"]; | ||
var _excluded = ["defaultValue", "error", "name", "label", "className", "description", "id", "inputClass"], | ||
_excluded2 = ["error", "name", "label", "description", "id", "className", "defaultValue", "items", "inputClass"]; | ||
@@ -7,7 +8,37 @@ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
import { cx } from '@daren/utils'; | ||
import * as React from 'react'; | ||
import { Dropdown } from './dropdown'; | ||
import { Input } from './input'; | ||
import { Label } from './misc'; | ||
var Field = /*#__PURE__*/React.forwardRef(function Field(_ref, ref) { | ||
function FieldWrapper(_ref) { | ||
var { | ||
children, | ||
className, | ||
description, | ||
descriptionId, | ||
error, | ||
errorId, | ||
inputId, | ||
label | ||
} = _ref; | ||
return /*#__PURE__*/React.createElement("div", { | ||
className: className | ||
}, /*#__PURE__*/React.createElement("div", { | ||
className: "flex justify-between" | ||
}, /*#__PURE__*/React.createElement(Label, { | ||
htmlFor: inputId, | ||
className: "mb-2" | ||
}, label), description && /*#__PURE__*/React.createElement("span", { | ||
className: "text-sm text-slate-400", | ||
id: descriptionId | ||
}, description)), children, error && /*#__PURE__*/React.createElement("p", { | ||
className: "mt-2 text-sm text-red-600", | ||
id: errorId | ||
}, error)); | ||
} | ||
var Field = /*#__PURE__*/React.forwardRef(function Field(_ref2, ref) { | ||
var { | ||
defaultValue, | ||
@@ -21,4 +52,4 @@ error, | ||
inputClass | ||
} = _ref, | ||
props = _objectWithoutPropertiesLoose(_ref, _excluded); | ||
} = _ref2, | ||
props = _objectWithoutPropertiesLoose(_ref2, _excluded); | ||
@@ -28,4 +59,41 @@ var inputId = id != null ? id : name; | ||
var descriptionId = inputId + "-description"; | ||
return /*#__PURE__*/React.createElement(FieldWrapper, { | ||
descriptionId: descriptionId, | ||
errorId: errorId, | ||
inputId: inputId, | ||
className: className, | ||
label: label, | ||
error: error, | ||
description: description | ||
}, /*#__PURE__*/React.createElement(Input, _extends({ | ||
hasError: !!error, | ||
className: inputClass | ||
}, props, { | ||
ref: ref, | ||
name: name, | ||
id: inputId, | ||
autoComplete: name, | ||
defaultValue: defaultValue, | ||
"aria-describedby": error ? errorId : description ? descriptionId : undefined | ||
}))); | ||
}); | ||
var DropdownField = /*#__PURE__*/React.forwardRef(function DropdownField(_ref3, ref) { | ||
var { | ||
error, | ||
name, | ||
label, | ||
description, | ||
id, | ||
className, | ||
defaultValue, | ||
items, | ||
inputClass | ||
} = _ref3, | ||
props = _objectWithoutPropertiesLoose(_ref3, _excluded2); | ||
var inputId = id != null ? id : name; | ||
var errorId = inputId + "-error"; | ||
var descriptionId = inputId + "-description"; | ||
return /*#__PURE__*/React.createElement("div", { | ||
className: className | ||
className: cx(className, 'w-full') | ||
}, /*#__PURE__*/React.createElement("div", { | ||
@@ -39,3 +107,3 @@ className: "flex justify-between" | ||
id: descriptionId | ||
}, description)), /*#__PURE__*/React.createElement(Input, _extends({ | ||
}, description)), /*#__PURE__*/React.createElement(Dropdown, _extends({ | ||
hasError: !!error, | ||
@@ -47,5 +115,4 @@ className: inputClass | ||
id: inputId, | ||
autoComplete: name, | ||
required: true, | ||
defaultValue: defaultValue, | ||
items: items, | ||
"aria-describedby": error ? errorId : description ? descriptionId : undefined | ||
@@ -57,3 +124,3 @@ })), error && /*#__PURE__*/React.createElement("p", { | ||
}); | ||
export { Field }; | ||
export { Field, DropdownField }; | ||
//# sourceMappingURL=field.js.map |
@@ -0,1 +1,2 @@ | ||
export * from './dropdown'; | ||
export * from './field'; | ||
@@ -2,0 +3,0 @@ export * from './input'; |
@@ -10,2 +10,3 @@ var _excluded = ["type", "hasError"]; | ||
import * as React from 'react'; | ||
import { getInputClassName } from './utils'; | ||
var Input = /*#__PURE__*/React.forwardRef(function Input(props, ref) { | ||
@@ -18,6 +19,3 @@ var { | ||
var className = cx(hasError ? 'border-red-300 border hover:border-transparent' : 'border-none', 'py-5 px-8 pr-10 w-full text-md font-bold placeholder:text-gray-500 disabled:text-gray-400 rounded-lg focus-ring', { | ||
'bg-primary-600 text-slate-900': !hasError, | ||
'!text-danger bg-primary-600 animate-shake !set-colors-accent-danger': hasError | ||
}, props.className); | ||
var className = getInputClassName(props.className, hasError); | ||
@@ -24,0 +22,0 @@ if (type === 'textarea') { |
import * as React from 'react'; | ||
declare type FieldProps = { | ||
defaultValue?: string | null; | ||
name: string; | ||
label: string; | ||
className?: string; | ||
error?: string | null; | ||
description?: React.ReactNode; | ||
inputClass?: string; | ||
}; | ||
import { DropdownProps } from './dropdown'; | ||
import { FieldProps } from './types'; | ||
declare const Field: React.ForwardRefExoticComponent<(Pick<FieldProps & { | ||
hasError?: boolean | undefined; | ||
} & React.ClassAttributes<HTMLInputElement> & React.InputHTMLAttributes<HTMLInputElement>, "id" | "name" | "onChange" | "value" | "hasError" | "className" | "defaultValue" | "children" | "form" | "label" | "slot" | "style" | "title" | "pattern" | "disabled" | "hidden" | "color" | "type" | "role" | "aria-labelledby" | "aria-expanded" | "aria-activedescendant" | "onKeyDown" | "key" | "accept" | "alt" | "autoComplete" | "autoFocus" | "capture" | "checked" | "crossOrigin" | "enterKeyHint" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "height" | "list" | "max" | "maxLength" | "min" | "minLength" | "multiple" | "placeholder" | "readOnly" | "required" | "size" | "src" | "step" | "width" | "defaultChecked" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "lang" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "error" | "description" | "inputClass"> | Pick<FieldProps & { | ||
hasError?: boolean | undefined; | ||
} & { | ||
type: "textarea"; | ||
} & React.ClassAttributes<HTMLTextAreaElement> & React.TextareaHTMLAttributes<HTMLTextAreaElement>, "hasError" | "type" | "key" | "autoComplete" | "autoFocus" | "cols" | "dirName" | "disabled" | "form" | "maxLength" | "minLength" | "name" | "placeholder" | "readOnly" | "required" | "rows" | "value" | "wrap" | "onChange" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "label" | "error" | "description" | "inputClass"> | Pick<FieldProps & { | ||
hasError?: boolean | undefined; | ||
} & React.ClassAttributes<HTMLInputElement> & React.InputHTMLAttributes<HTMLInputElement>, "hasError" | "type" | "key" | "autoComplete" | "autoFocus" | "disabled" | "form" | "maxLength" | "minLength" | "name" | "placeholder" | "readOnly" | "required" | "value" | "onChange" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "accept" | "alt" | "capture" | "checked" | "crossOrigin" | "enterKeyHint" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "height" | "list" | "max" | "min" | "multiple" | "pattern" | "size" | "src" | "step" | "width" | "label" | "error" | "description" | "inputClass">) & React.RefAttributes<HTMLInputElement>>; | ||
export { Field }; | ||
} & React.ClassAttributes<HTMLTextAreaElement> & React.TextareaHTMLAttributes<HTMLTextAreaElement>, "id" | "name" | "onChange" | "value" | "hasError" | "className" | "defaultValue" | "children" | "form" | "label" | "slot" | "style" | "title" | "disabled" | "hidden" | "color" | "type" | "role" | "aria-labelledby" | "aria-expanded" | "aria-activedescendant" | "onKeyDown" | "key" | "autoComplete" | "autoFocus" | "maxLength" | "minLength" | "placeholder" | "readOnly" | "required" | "defaultChecked" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "lang" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "cols" | "dirName" | "rows" | "wrap" | "error" | "description" | "inputClass">) & React.RefAttributes<HTMLInputElement>>; | ||
declare const DropdownField: React.ForwardRefExoticComponent<FieldProps & DropdownProps & React.RefAttributes<HTMLInputElement>>; | ||
export { Field, DropdownField }; |
@@ -0,1 +1,2 @@ | ||
export * from './dropdown'; | ||
export * from './field'; | ||
@@ -2,0 +3,0 @@ export * from './input'; |
import * as React from 'react'; | ||
declare const Input: React.ForwardRefExoticComponent<(Pick<{ | ||
hasError?: boolean | undefined; | ||
} & React.ClassAttributes<HTMLInputElement> & React.InputHTMLAttributes<HTMLInputElement>, "hasError" | "key" | keyof React.InputHTMLAttributes<HTMLInputElement>> | Pick<{ | ||
hasError?: boolean | undefined; | ||
} & { | ||
type: "textarea"; | ||
} & React.ClassAttributes<HTMLTextAreaElement> & React.TextareaHTMLAttributes<HTMLTextAreaElement>, "hasError" | "type" | "key" | keyof React.TextareaHTMLAttributes<HTMLTextAreaElement>> | Pick<{ | ||
hasError?: boolean | undefined; | ||
} & React.ClassAttributes<HTMLInputElement> & React.InputHTMLAttributes<HTMLInputElement>, "hasError" | "key" | keyof React.InputHTMLAttributes<HTMLInputElement>>) & React.RefAttributes<HTMLInputElement>>; | ||
} & React.ClassAttributes<HTMLTextAreaElement> & React.TextareaHTMLAttributes<HTMLTextAreaElement>, "hasError" | "type" | "key" | keyof React.TextareaHTMLAttributes<HTMLTextAreaElement>>) & React.RefAttributes<HTMLInputElement>>; | ||
export { Input }; |
/// <reference types="react" /> | ||
export declare type InputProps = { | ||
declare type InputProps = { | ||
hasError?: boolean; | ||
@@ -7,1 +7,11 @@ } & (({ | ||
} & JSX.IntrinsicElements['textarea']) | JSX.IntrinsicElements['input']); | ||
declare type FieldProps = { | ||
defaultValue?: string | null; | ||
name: string; | ||
label: string; | ||
className?: string; | ||
error?: string | null; | ||
description?: React.ReactNode; | ||
inputClass?: string; | ||
}; | ||
export type { InputProps, FieldProps }; |
{ | ||
"name": "@daren/form-elements", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"repository": { | ||
@@ -40,2 +40,3 @@ "type": "git", | ||
"@daren/utils": "^1.3.0", | ||
"@headlessui/react": "^1.5.0", | ||
"@heroicons/react": "^1.0.5" | ||
@@ -52,3 +53,3 @@ }, | ||
}, | ||
"gitHead": "471b89c39b302c0899d39333817d39f045fe5426" | ||
"gitHead": "92428f337d2967c9ca0e819d7b3908d72aaa5794" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
86976
37
756
4
+ Added@headlessui/react@^1.5.0
+ Added@headlessui/react@1.7.19(transitive)
+ Added@tanstack/react-virtual@3.12.0(transitive)
+ Added@tanstack/virtual-core@3.12.0(transitive)
+ Addedclient-only@0.0.1(transitive)
+ Addedjs-tokens@4.0.0(transitive)
+ Addedloose-envify@1.4.0(transitive)
+ Addedreact@18.3.1(transitive)
+ Addedreact-dom@18.3.1(transitive)
+ Addedscheduler@0.23.2(transitive)