From 6f47f2da79c13fd3e16655a6129ae126f417a819 Mon Sep 17 00:00:00 2001 From: acd02 Date: Thu, 26 Oct 2023 11:36:08 +0200 Subject: [PATCH] feat(rating): init package --- package-lock.json | 19 ++++++++ packages/components/rating/.npmignore | 2 + packages/components/rating/LICENSE.md | 21 ++++++++ packages/components/rating/README.md | 13 +++++ packages/components/rating/package.json | 48 +++++++++++++++++++ packages/components/rating/src/Rating.doc.mdx | 33 +++++++++++++ .../components/rating/src/Rating.stories.tsx | 12 +++++ .../components/rating/src/Rating.test.tsx | 12 +++++ packages/components/rating/src/Rating.tsx | 1 + packages/components/rating/src/index.ts | 1 + packages/components/rating/tsconfig.json | 4 ++ packages/components/rating/vite.config.ts | 6 +++ 12 files changed, 172 insertions(+) create mode 100644 packages/components/rating/.npmignore create mode 100644 packages/components/rating/LICENSE.md create mode 100644 packages/components/rating/README.md create mode 100644 packages/components/rating/package.json create mode 100644 packages/components/rating/src/Rating.doc.mdx create mode 100644 packages/components/rating/src/Rating.stories.tsx create mode 100644 packages/components/rating/src/Rating.test.tsx create mode 100644 packages/components/rating/src/Rating.tsx create mode 100644 packages/components/rating/src/index.ts create mode 100644 packages/components/rating/tsconfig.json create mode 100644 packages/components/rating/vite.config.ts diff --git a/package-lock.json b/package-lock.json index 3fd2c218e..c9d3f026c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2407,6 +2407,7 @@ }, "node_modules/@clack/prompts/node_modules/is-unicode-supported": { "version": "1.3.0", + "extraneous": true, "inBundle": true, "license": "MIT", "engines": { @@ -7506,6 +7507,10 @@ "resolved": "packages/components/radio-group", "link": true }, + "node_modules/@spark-ui/rating": { + "resolved": "packages/components/rating", + "link": true + }, "node_modules/@spark-ui/slider": { "resolved": "packages/components/slider", "link": true @@ -34117,6 +34122,20 @@ "tailwindcss": "^3.0.0" } }, + "packages/components/rating": { + "name": "@spark-ui/rating", + "version": "0.0.1", + "license": "MIT", + "devDependencies": { + "@spark-ui/icon": "^2.1.0", + "@spark-ui/icons": "^1.21.0" + }, + "peerDependencies": { + "react": "^16.8 || ^17.0 || ^18.0", + "react-dom": "^16.8 || ^17.0 || ^18.0", + "tailwindcss": "^3.0.0" + } + }, "packages/components/slider": { "name": "@spark-ui/slider", "version": "1.0.2", diff --git a/packages/components/rating/.npmignore b/packages/components/rating/.npmignore new file mode 100644 index 000000000..14144f5f7 --- /dev/null +++ b/packages/components/rating/.npmignore @@ -0,0 +1,2 @@ +src +**/*.stories.* diff --git a/packages/components/rating/LICENSE.md b/packages/components/rating/LICENSE.md new file mode 100644 index 000000000..62d374781 --- /dev/null +++ b/packages/components/rating/LICENSE.md @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Adevinta ASA. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/components/rating/README.md b/packages/components/rating/README.md new file mode 100644 index 000000000..a6bbfcfdc --- /dev/null +++ b/packages/components/rating/README.md @@ -0,0 +1,13 @@ +# Rating +> @spark-ui/rating + +[![storybook](https://img.shields.io/badge/storybook-black?logo=storybook)](https://sparkui.vercel.app/?path=/docs/components-rating--docs) +[![documentation](https://img.shields.io/badge/documentation-black?logo=googledocs)](https://sparkui-adv.vercel.app/docs/components/rating) +[![issue](https://img.shields.io/badge/report%20a%20bug-black?logo=openbugbounty&logoColor=red)](https://github.com/adevinta/spark/issues/new?&projects=4&template=bug-report.yml&assignees=&labels=component,rating) +[![npm](https://img.shields.io/npm/dt/%40spark-ui/rating?logo=npm&labelColor=black)](https://www.npmjs.com/package/@spark-ui/rating) + + +This package is part of the [`@spark-ui`](https://github.com/adevinta/spark) react-js user interface component library project. + +[![Issues open](https://img.shields.io/github/issues-search/adevinta/spark?query=is%3Aopen%20label%3Acomponent%20label%3Arating&logo=openbugbounty&logoColor=red&label=issues%20open&color=red)](https://github.com/adevinta/spark/issues?q=is%3Aopen+label%3Acomponent+label%3Arating) +[![NPM](https://img.shields.io/npm/l/%40spark-ui%2Frating)](https://github.com/adevinta/spark/blob/main/packages/components/rating/LICENSE.md) diff --git a/packages/components/rating/package.json b/packages/components/rating/package.json new file mode 100644 index 000000000..65a30a567 --- /dev/null +++ b/packages/components/rating/package.json @@ -0,0 +1,48 @@ +{ + "name": "@spark-ui/rating", + "version": "0.0.1", + "description": "Ratings let users see and/or set a star rating for a product or other item", + "publishConfig": { + "access": "public" + }, + "keywords": [ + "@spark-ui", + "react", + "component", + "accessible", + "accessibility", + "wai-aria", + "aria", + "a11y", + "rating" + ], + "main": "./dist/index.js", + "module": "./dist/index.mjs", + "types": "./dist/index.d.ts", + "scripts": { + "build": "vite build" + }, + "devDependencies": { + "@spark-ui/icons": "^1.21.0", + "@spark-ui/icon": "^2.1.0" + }, + "peerDependencies": { + "react": "^16.8 || ^17.0 || ^18.0", + "react-dom": "^16.8 || ^17.0 || ^18.0", + "tailwindcss": "^3.0.0" + }, + "repository": { + "type": "git", + "url": "https://github.com/adevinta/spark.git", + "directory": "packages/components/rating" + }, + "config": { + "title": "rating", + "category": "components" + }, + "bugs": { + "url": "https://github.com/adevinta/spark/issues?q=is%3Aopen+label%3Autility+label%3Arating" + }, + "homepage": "https://sparkui.vercel.app", + "license": "MIT" +} diff --git a/packages/components/rating/src/Rating.doc.mdx b/packages/components/rating/src/Rating.doc.mdx new file mode 100644 index 000000000..2d35f5ece --- /dev/null +++ b/packages/components/rating/src/Rating.doc.mdx @@ -0,0 +1,33 @@ +import { Meta, Canvas } from '@storybook/addon-docs' +import { ArgTypes } from '@storybook/blocks'; + +import { Rating } from '.' + +import * as stories from './Rating.stories' + + + +# Rating + +Ratings let users see and/or set a star rating for a product or other item. + +## Install + +```sh +npm install @spark-ui/rating +``` + +## Import + +```tsx +import { Rating } from "@spark-ui/rating" +``` + +## Props + + + +## Usage + +### Default + diff --git a/packages/components/rating/src/Rating.stories.tsx b/packages/components/rating/src/Rating.stories.tsx new file mode 100644 index 000000000..a0fa3c937 --- /dev/null +++ b/packages/components/rating/src/Rating.stories.tsx @@ -0,0 +1,12 @@ +import { Meta, StoryFn } from '@storybook/react' + +import { Rating } from '.' + +const meta: Meta = { + title: 'Experimental/Rating', + component: Rating, +} + +export default meta + +export const Default: StoryFn = _args => diff --git a/packages/components/rating/src/Rating.test.tsx b/packages/components/rating/src/Rating.test.tsx new file mode 100644 index 000000000..8fa455031 --- /dev/null +++ b/packages/components/rating/src/Rating.test.tsx @@ -0,0 +1,12 @@ +import { render, screen } from '@testing-library/react' +import { describe, expect, it } from 'vitest' + +import { Rating } from './Rating' + +describe('Rating', () => { + it('should render', () => { + render() + + expect(screen.getByText(/rating/)).toBeInTheDocument() + }) +}) diff --git a/packages/components/rating/src/Rating.tsx b/packages/components/rating/src/Rating.tsx new file mode 100644 index 000000000..ab37e7eb1 --- /dev/null +++ b/packages/components/rating/src/Rating.tsx @@ -0,0 +1 @@ +export const Rating = () => <>rating diff --git a/packages/components/rating/src/index.ts b/packages/components/rating/src/index.ts new file mode 100644 index 000000000..9bb41d714 --- /dev/null +++ b/packages/components/rating/src/index.ts @@ -0,0 +1 @@ +export { Rating } from './Rating' diff --git a/packages/components/rating/tsconfig.json b/packages/components/rating/tsconfig.json new file mode 100644 index 000000000..18f4c0e16 --- /dev/null +++ b/packages/components/rating/tsconfig.json @@ -0,0 +1,4 @@ +{ + "extends": "../../../tsconfig.json", + "include": ["src/**/*", "../../../global.d.ts"] +} diff --git a/packages/components/rating/vite.config.ts b/packages/components/rating/vite.config.ts new file mode 100644 index 000000000..64973e5ac --- /dev/null +++ b/packages/components/rating/vite.config.ts @@ -0,0 +1,6 @@ +import path from 'path' +import { getComponentConfiguration } from '../../../config/index' + +const { name } = require(path.resolve(__dirname, 'package.json')) + +export default getComponentConfiguration(process.cwd(), name)