1.1.0 • Published 3 months ago

domaincomponent v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

Installation

npm install domaincomponent

Usage

DomainTextInput Component

Description

DomainTextInput is a customizable text input component that extends TextInputProps and TextInputIOSProps, providing additional styling and configuration options.

Props

PropsTypeRequiredDescription
styleStyleProp<ViewStyle>❌ NoStyling for the view container.
widthnumber❌ NoCustom width for the input component.
editableboolean❌ NoDetermines if the input is editable.
focusColorColorValue❌ NoColor of the input when focused.
namestring✅ YesName of the input field (used for form handling).
nextNamestring❌ NoName of the next input field for navigation.
leftReactNode❌ NoLeft-side component inside the input (e.g., icon).
leftWidthDimensionValue❌ NoWidth of the left component.
rightReactNode❌ NoRight-side component inside the input (e.g., icon).
rightWidthDimensionValue❌ NoWidth of the right component.
helperTextstring❌ NoText displayed below the input for guidance.
helperTextColorColorValue❌ NoColor of the helper text.
labelstring❌ NoLabel text for the input.
labelColorColorValue❌ NoColor of the label text.
inputColorColorValue❌ NoText color of the input field.

Example Usage

import React from 'react';
import { View } from 'react-native';
import { DomainTextInput } from 'domaincomponent';

const App = () => {
  return (
    <View>
      <DomainTextInput
        name="email"
        label="Email Address"
        helperText="Enter a valid email"
        inputColor="black"
        labelColor="gray"
      />
    </View>
  );
};

export default App;

DomainSelect Component

Description

DomainSelect is a customizable dropdown/select component that allows users to choose from a list of options. It supports labels, placeholders, and optional left/right icons.

image

Props

PropsTypeRequiredDescription
styleStyleProp<ViewStyle>❌ NoStyling for the select container.
optionsOption[]✅ YesArray of selectable options.
valuestring❌ NoSelected option's ID.
onChange(value: string \| undefined) => void❌ NoCallback function triggered when an option is selected.
placeholderstring❌ NoPlaceholder text displayed when no option is selected.
labelstring❌ NoLabel for the select input.
resetButtonboolean❌ NoDisplays a reset button to clear selection if true.

Option Object Structure

Each option in the options array follows this structure:

export interface Option {
    id: string;         // Unique identifier for the option
    name: string;       // Display name of the option
    left?: ReactNode;   // (Optional) Left-side icon/component
    right?: ReactNode;  // (Optional) Right-side icon/component
}

Example Usage

import React, { useState } from 'react';
import { View } from 'react-native';
import { DomainSelect } from 'domaincomponent';

const options = [
  { id: '1', name: 'Option 1' },
  { id: '2', name: 'Option 2' },
  { id: '3', name: 'Option 3' },
];

const App = () => {
  const [selectedValue, setSelectedValue] = useState<string | undefined>();

  return (
    <View>
      <DomainSelect
        options={options}
        value={selectedValue}
        onChange={setSelectedValue}
        placeholder="Select an option"
        label="Dropdown"
        resetButton={true}
      />
    </View>
  );
};

export default App;

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


Made with create-react-native-library

JSONStreamabort-controlleracceptsacornacorn-jsxacorn-walkadd-streamagent-baseaggregate-errorajvanseransi-alignansi-escapesansi-regexansi-stylesanymatchargargparsearray-buffer-byte-lengtharray-ifyarray-includesarray-unionarray.prototype.findlastarray.prototype.flatarray.prototype.flatmaparray.prototype.tosortedarraybuffer.prototype.slicearrifyasapast-typesasync-functionasync-limiterasync-retryatomicallyavailable-typed-arraysbabel-corebabel-jestbabel-plugin-istanbulbabel-plugin-jest-hoistbabel-plugin-module-resolverbabel-plugin-polyfill-corejs2babel-plugin-polyfill-corejs3babel-plugin-polyfill-regeneratorbabel-plugin-syntax-hermes-parserbabel-plugin-transform-flow-enumsbabel-preset-current-node-syntaxbabel-preset-jestbalanced-matchbase64-jsbasic-ftpbefore-after-hookblboxenbrace-expansionbracesbrowserslistbserbufferbuffer-frombundle-namecall-bindcall-bind-apply-helperscall-boundcaller-callsitecaller-pathcallsitescamelcasecamelcase-keyscaniuse-litechalkchar-regexchardetchrome-launcherchromium-edge-launcherci-infocjs-module-lexerclean-stackcli-boxescli-cursorcli-spinnerscli-widthcliuicloneclone-deepcocollect-v8-coveragecolor-convertcolor-namecommandercommondircompare-funcconcat-mapconcat-streamconfig-chainconfigstoreconnectconventional-changelogconventional-changelog-angularconventional-changelog-atomconventional-changelog-codemirrorconventional-changelog-conventionalcommitsconventional-changelog-coreconventional-changelog-emberconventional-changelog-eslintconventional-changelog-expressconventional-changelog-jqueryconventional-changelog-jshintconventional-changelog-preset-loaderconventional-changelog-writerconventional-commits-filterconventional-commits-parserconventional-recommended-bumpconvert-source-mapcore-js-compatcore-util-iscosmiconfigcreate-jestcreate-requirecross-spawncsstypedargsdata-uri-to-bufferdata-view-bufferdata-view-byte-lengthdata-view-byte-offsetdebugdecamelizedecamelize-keysdedentdeep-extenddeep-isdeepmergedefault-browserdefault-browser-iddefaultsdefine-data-propertydefine-lazy-propdefine-propertiesdegeneratordeldenodeifydepddeprecationdestroydetect-newlinediffdiff-sequencesdir-globdoctrinedomaincomponentdot-propdunder-protoee-firstelectron-to-chromiumemitteryemoji-regexencodeurlend-of-streamenv-pathserror-exerror-stack-parseres-abstractes-define-propertyes-errorses-iterator-helperses-object-atomses-set-tostringtages-shim-unscopableses-to-primitiveescaladeescape-goatescape-htmlescape-string-regexpescodegeneslint-plugin-eslint-commentseslint-plugin-ft-floweslint-plugin-jesteslint-plugin-reacteslint-plugin-react-hookseslint-plugin-react-nativeeslint-plugin-react-native-globalseslint-scopeeslint-visitor-keysespreeesprimaesqueryesrecurseestraverseesutilsetagevent-target-shimexecaexitexpectexpoexponential-backoffexternal-editorfast-deep-equalfast-difffast-globfast-json-stable-stringifyfast-levenshteinfast-urifastqfb-watchmanfile-entry-cachefill-rangefinalhandlerfind-babel-configfind-cache-dirfind-upfind-up-simpleflat-cacheflattedflow-enums-runtimeflow-parserfor-eachfreshfs-extrafs.realpathfunction-bindfunction.prototype.namefunctions-have-namesgensyncget-caller-fileget-east-asian-widthget-intrinsicget-package-typeget-protoget-streamget-symbol-descriptionget-urigit-raw-commitsgit-semver-tagsgit-upgit-url-parseglobglob-parentglobal-directoryglobal-dirsglobalsglobalthisglobbygopdgraceful-fsgraphemerhandlebarshard-rejectionhas-bigintshas-flaghas-property-descriptorshas-protohas-symbolshas-tostringtaghasownhermes-estreehermes-parserhosted-git-infohtml-escaperhttp-errorshttp-proxy-agenthttps-proxy-agenthuman-signalsiconv-liteieee754ignoreimage-sizeimport-freshimport-localimurmurhashindent-stringindex-to-positioninflightinheritsiniinquirerinternal-slotinterpretinvariantip-addressis-absoluteis-array-bufferis-arrayishis-async-functionis-bigintis-boolean-objectis-callableis-core-moduleis-data-viewis-date-objectis-directoryis-dockeris-extglobis-finalizationregistryis-fullwidth-code-pointis-generator-fnis-generator-functionis-git-dirtyis-git-repositoryis-globis-in-ciis-inside-containeris-installed-globallyis-interactiveis-mapis-npmis-numberis-number-objectis-objis-path-cwdis-path-insideis-plain-objis-plain-objectis-regexis-relativeis-setis-shared-array-bufferis-sshis-streamis-stringis-symbolis-text-pathis-typed-arrayis-unc-pathis-unicode-supportedis-weakmapis-weakrefis-weaksetis-windowsis-wslisarrayisexeisobjectissue-parseristanbul-lib-coverageistanbul-lib-instrumentistanbul-lib-reportistanbul-lib-source-mapsistanbul-reportsiterator.prototypejest-changed-filesjest-circusjest-clijest-configjest-diffjest-docblockjest-eachjest-environment-nodejest-get-typejest-haste-mapjest-leak-detectorjest-matcher-utilsjest-message-utiljest-mockjest-pnp-resolverjest-regex-utiljest-resolvejest-resolve-dependenciesjest-runnerjest-runtimejest-snapshotjest-utiljest-validatejest-watcherjest-workerjs-tokensjs-yamljsbnjsc-androidjsc-safe-urljscodeshiftjsescjson-bufferjson-parse-better-errorsjson-parse-even-better-errorsjson-schema-traversejson-stable-stringify-without-jsonifyjson5jsonfilejsonparsejsx-ast-utilskeyvkind-ofkleurkylatest-versionlevenlevnlighthouse-loggerlines-and-columnslocate-pathlodashlodash.camelcaselodash.capitalizelodash.debouncelodash.escaperegexplodash.isfunctionlodash.isplainobjectlodash.isstringlodash.kebabcaselodash.mergelodash.mergewithlodash.snakecaselodash.startcaselodash.throttlelodash.uniqlodash.uniqbylodash.upperfirstlog-symbolsloose-envifylru-cachemacos-releasemake-dirmake-errormakeerrormap-objmarkymath-intrinsicsmemoize-onemeowmerge-streammerge2metrometro-babel-transformermetro-cachemetro-cache-keymetro-configmetro-coremetro-file-mapmetro-minify-tersermetro-resolvermetro-runtimemetro-source-mapmetro-symbolicatemetro-transform-pluginsmetro-transform-workermicromatchmimemime-dbmime-typesmimic-fnmimic-functionmin-indentminimatchminimistminimist-optionsminipassmkdirpmsmute-streamnatural-comparenatural-compare-litenegotiatorneo-asyncnetmasknew-github-release-urlnode-abort-controllernode-dirnode-fetchnode-forgenode-int64node-releasesnormalize-package-datanormalize-pathnpm-run-pathnullthrowsob1object-assignobject-inspectobject-keysobject.assignobject.entriesobject.fromentriesobject.valueson-finishedonceonetimeopenoptionatororaos-nameos-tmpdirown-keysp-limitp-locatep-mapp-trypac-proxy-agentpac-resolverpackage-jsonparent-moduleparse-jsonparse-pathparse-urlparseurlpath-existspath-is-absolutepath-keypath-parsepath-scurrypath-typepicocolorspicomatchpifypiratespkg-dirpkg-uppossible-typed-array-namesprelude-lsprettier-linter-helperspretty-formatprocess-nextick-argspromisepromptsprop-typesproto-listprotocolsproxy-agentproxy-from-envpumppunycodepupapure-randqueuequeue-microtaskquick-lrurange-parserrcreact-devtools-corereact-isreact-refreshread-package-upread-pkgread-pkg-upreadable-streamreadlinerecastrechoirredentreflect.getprototypeofregenerateregenerate-unicode-propertiesregenerator-runtimeregenerator-transformregexp.prototype.flagsregexpu-coreregistry-auth-tokenregistry-urlregjsgenregjsparserrequire-directoryrequire-from-stringreselectresolveresolve-cwdresolve-fromresolve-globalresolve.exportsrestore-cursorretryreusifyrimrafrun-applescriptrun-asyncrun-parallelrxjssafe-array-concatsafe-buffersafe-push-applysafe-regex-testsafer-bufferschedulerselfsignedsemversendserialize-errorserve-staticset-function-lengthset-function-nameset-protosetprototypeofshallow-cloneshebang-commandshebang-regexshell-quoteshelljsside-channelside-channel-listside-channel-mapside-channel-weakmapsignal-exitsisteransislashsmart-buffersockssocks-proxy-agentsource-mapsource-map-supportspdx-correctspdx-exceptionsspdx-expression-parsespdx-license-idssplit2sprintf-jsstack-utilsstackframestacktrace-parserstatusesstdin-discarderstring-lengthstring-natural-comparestring-widthstring.prototype.matchallstring.prototype.repeatstring.prototype.trimstring.prototype.trimendstring.prototype.trimstartstring_decoderstrip-ansistrip-bomstrip-final-newlinestrip-indentstrip-json-commentsstubborn-fssupports-colorsupports-preserve-symlinks-flagsynckittemptersertest-excludetext-extensionstext-tablethroatthroughthrough2tmptmplto-regex-rangetoidentifiertr46trim-newlinestslibtsutilstype-checktype-detecttype-festtyped-array-buffertyped-array-byte-lengthtyped-array-byte-offsettyped-array-lengthtypedarrayuglify-jsunbox-primitiveunc-path-regexundici-typesunicode-canonical-property-names-ecmascriptunicode-match-property-ecmascriptunicode-match-property-value-ecmascriptunicode-property-aliases-ecmascriptunicorn-magicuniversal-user-agentuniversalifyunpipeupdate-browserslist-dbupdate-notifieruri-jsurl-joinutil-deprecateutils-mergev8-compile-cache-libv8-to-istanbulvalidate-npm-package-licensevlqwalkerwcwidthwebidl-conversionswhatwg-fetchwhatwg-urlwhen-exitwhichwhich-boxed-primitivewhich-builtin-typewhich-collectionwhich-typed-arraywidest-linewildcard-matchwindows-releaseword-wrapwordwrapwrap-ansiwrappywrite-file-atomicwsxdg-basedirxtendy18nyallistyargsyargs-parserynyocto-queueyoctocolors-cjs
1.1.0

3 months ago

1.0.0

4 months ago

0.2.0

4 months ago

0.1.0

4 months ago