Skip to content

Commit

Permalink
v1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Vasyl Derenko authored and Vasyl Derenko committed Jul 25, 2023
1 parent 745bf13 commit e83e9d6
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 23 deletions.
12 changes: 0 additions & 12 deletions .storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
// .storybook/preview.jsx
import React from 'react';

import {
Title,
Subtitle,
Description,
Primary,
Controls,
Stories,
} from '@storybook/blocks';

export default {
parameters: {
actions: { argTypesRegex: '^on[A-Z].*' },
Expand Down
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,9 @@ NovaPoshta © address and warehouse selects. It contains two selects, which requ

#### Script tag:

Go to `/build` folder and download `np-select.umd.js` and `np-select.css`, `np-select.d.ts` if you want to have `.ts` types
Go to `/build` folder and download `np-select.umd.js`, `np-select.d.ts` if you want to have `.ts` types

```html
<link rel="stylesheet" type="text/css" href="np-select.css"/>

<script type="text/javascript" src="np-select.umd.js"></script>
```

Expand Down
1 change: 0 additions & 1 deletion build/np-select.css

This file was deleted.

3 changes: 2 additions & 1 deletion build/np-select.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion build/np-select.umd.js

Large diffs are not rendered by default.

11 changes: 10 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "np-select",
"description": "Nova Poshta city and warehouse selects.",
"version": "1.0.0",
"version": "1.0.1",
"main": "build/np-select.js",
"scripts": {
"build": "tsc && vite --config vite.config.js build && npm run build:dts",
Expand Down Expand Up @@ -45,6 +45,7 @@
"storybook": "^7.1.0",
"typescript": "^5.1.6",
"vite": "^4.4.6",
"vite-plugin-css-injected-by-js": "^3.2.1",
"vite-plugin-static-copy": "^0.17.0"
}
}
8 changes: 8 additions & 0 deletions src/base-select/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ export class NpBaseSelect {
onMounted = () => {},
apiKey,
}: NpBaseSelectConfig) {
if (!root) {
throw new TypeError('root element is not passed or it is not valid');
}

if (!apiKey) {
console.error('apiKey is not passed');
}

this.options = options.map(item => getOption(item));
this.filtered = options.map(item => getOption(item));
this.open = false;
Expand Down
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const NpCitySelect = (config: NpCitySelectConfig) => {
text: config.button?.text || 'Select City',
},
input: {
name: config.input?.name,
name: config.input?.name || 'city',
placeholder: config.input?.placeholder || 'Select City',
},
placeholder: {
Expand Down Expand Up @@ -57,10 +57,10 @@ export const NpWarehouseSelect = (config: NpWarehouseSelectConfig) => {
root: config.root,
apiKey: config.apiKey,
button: {
text: config.button.text || 'Select Warehouse',
text: config.button?.text || 'Select Warehouse',
},
input: {
name: config.input.name,
name: config.input?.name || 'warehouse',
placeholder: config.input?.placeholder || 'Select Warehouse',
},
placeholder: {
Expand Down
2 changes: 2 additions & 0 deletions vite.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import path from 'path';
import { defineConfig } from 'vite';
import cssInjectedByJsPlugin from 'vite-plugin-css-injected-by-js';

export default defineConfig({
build: {
Expand All @@ -19,6 +20,7 @@ export default defineConfig({
},
},
},
plugins: [cssInjectedByJsPlugin()],
resolve: {
alias: [{ find: '@', replacement: path.resolve(__dirname, 'src') }],
},
Expand Down

0 comments on commit e83e9d6

Please sign in to comment.