refactor: use @astro-reactive/common

This commit is contained in:
Ayo 2022-10-28 12:41:32 +02:00
parent 40dba08c6a
commit 79882fd9b1
10 changed files with 33 additions and 16 deletions

23
package-lock.json generated
View file

@ -288,6 +288,10 @@
"node": ">=6.0.0"
}
},
"node_modules/@astro-reactive/common": {
"resolved": "packages/common",
"link": true
},
"node_modules/@astro-reactive/form": {
"resolved": "packages/form",
"link": true
@ -2853,10 +2857,6 @@
"node": ">= 10"
}
},
"node_modules/common": {
"resolved": "packages/common",
"link": true
},
"node_modules/common-ancestor-path": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/common-ancestor-path/-/common-ancestor-path-1.0.1.tgz",
@ -10472,7 +10472,8 @@
}
},
"packages/common": {
"version": "0.0.0",
"name": "@astro-reactive/common",
"version": "0.0.1",
"license": "MIT",
"devDependencies": {}
},
@ -10481,6 +10482,7 @@
"version": "0.5.1",
"license": "MIT",
"dependencies": {
"@astro-reactive/common": "^0.0.1",
"@astro-reactive/validator": "^0.1.0"
},
"devDependencies": {
@ -10518,6 +10520,9 @@
"name": "@astro-reactive/validator",
"version": "0.1.0",
"license": "MIT",
"dependencies": {
"@astro-reactive/common": "^0.0.1"
},
"devDependencies": {
"@types/chai": "^4.3.3",
"@types/eslint": "^8.4.6",
@ -10732,9 +10737,13 @@
"@jridgewell/trace-mapping": "^0.3.9"
}
},
"@astro-reactive/common": {
"version": "file:packages/common"
},
"@astro-reactive/form": {
"version": "file:packages/form",
"requires": {
"@astro-reactive/common": "^0.0.1",
"@astro-reactive/validator": "^0.1.0",
"@types/chai": "^4.3.3",
"@types/eslint": "^8.4.6",
@ -10764,6 +10773,7 @@
"@astro-reactive/validator": {
"version": "file:packages/validator",
"requires": {
"@astro-reactive/common": "^0.0.1",
"@types/chai": "^4.3.3",
"@types/eslint": "^8.4.6",
"@types/mocha": "^10.0.0",
@ -12702,9 +12712,6 @@
"integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==",
"dev": true
},
"common": {
"version": "file:packages/common"
},
"common-ancestor-path": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/common-ancestor-path/-/common-ancestor-path-1.0.1.tgz",

1
packages/common/index.ts Normal file
View file

@ -0,0 +1 @@
export * from "./types";

View file

@ -1,5 +1,5 @@
---
import type { ValidationError } from 'common/types';
import type { ValidationError } from '@astro-reactive/common';
export interface Props {
errors: ValidationError[];

View file

@ -2,7 +2,7 @@
/**
* DEFAULT CONTROL COMPONENT
*/
import type { Radio } from 'common/types';
import type { Radio } from '@astro-reactive/common';
import type { FormControl } from '../core/form-control';
import Input from './controls/Input.astro';
import RadioGroup from './controls/RadioGroup.astro';

View file

@ -1,5 +1,5 @@
---
import type { Submit } from 'common/types';
import type { Submit } from '@astro-reactive/common';
import { FormGroup, FormControl } from '../core';
import FieldSet from './FieldSet.astro';
import Field from './Field.astro';

View file

@ -2,7 +2,7 @@
/**
* RADIO GROUP COMPONENT
*/
import type { Radio } from 'common/types';
import type { Radio } from '@astro-reactive/common';
export interface Props {
control: Radio;
@ -24,7 +24,12 @@ const options = control.options.map((option) => {
{
options.map((option) => (
<div class="radio-option">
<input type="radio" name={control.name} value={option.value} checked={option.value === control.value} />{' '}
<input
type="radio"
name={control.name}
value={option.value}
checked={option.value === control.value}
/>{' '}
{option.label}
</div>
))

View file

@ -56,6 +56,7 @@
},
"license": "MIT",
"dependencies": {
"@astro-reactive/validator": "^0.1.0"
"@astro-reactive/validator": "^0.1.0",
"@astro-reactive/common": "^0.0.1"
}
}

View file

@ -1,5 +1,5 @@
---
import type { HookType } from 'common/types';
import type { HookType } from '@astro-reactive/common';
export interface Props {
hook?: HookType;

View file

@ -1,4 +1,4 @@
import type { ValidationError } from 'common/types';
import type { ValidationError } from '@astro-reactive/common';
import { Validators } from './validator-names';
/**

View file

@ -52,6 +52,9 @@
"peerDependencies": {
"astro": "^1.5.0"
},
"dependencies": {
"@astro-reactive/common": "^0.0.1"
},
"main": "index.js",
"directories": {
"test": "test"