From b4335b282adbc9cf9f844f243bb6156831a0b945 Mon Sep 17 00:00:00 2001 From: Driss Chelouati Date: Thu, 11 Jan 2024 15:20:25 +0100 Subject: [PATCH] feat: add nui-mark utility stories --- src/plugins/components/mark/mark.component.ts | 20 ++++++++ src/plugins/components/mark/mark.doc.mdx | 50 +++++++++++++++++++ src/plugins/components/mark/mark.stories.ts | 25 ++++++++++ src/plugins/components/mark/mark.types.ts | 10 ++++ src/plugins/components/mark/mark.variants.ts | 1 + 5 files changed, 106 insertions(+) create mode 100644 src/plugins/components/mark/mark.component.ts create mode 100644 src/plugins/components/mark/mark.doc.mdx create mode 100644 src/plugins/components/mark/mark.stories.ts create mode 100644 src/plugins/components/mark/mark.types.ts create mode 100644 src/plugins/components/mark/mark.variants.ts diff --git a/src/plugins/components/mark/mark.component.ts b/src/plugins/components/mark/mark.component.ts new file mode 100644 index 0000000..203ed7b --- /dev/null +++ b/src/plugins/components/mark/mark.component.ts @@ -0,0 +1,20 @@ +import { html } from 'lit' +import { spread } from '@open-wc/lit-helpers' + +import type { MarkAttrs } from './mark.types' +import * as variants from './mark.variants' + +/** + * Primary UI component for user interaction + */ +export const Mark = ({ ...attrs }: MarkAttrs) => { + return html` +
+

+ Iam a text that contains + some marked words + inside. +

+
+ ` +} diff --git a/src/plugins/components/mark/mark.doc.mdx b/src/plugins/components/mark/mark.doc.mdx new file mode 100644 index 0000000..90bc3f5 --- /dev/null +++ b/src/plugins/components/mark/mark.doc.mdx @@ -0,0 +1,50 @@ +import { Meta, Primary, Controls, Story } from '@storybook/blocks' +import * as MarkStories from './mark.stories' +import { defaultConfig } from './mark.config' + + + +# nui-mark + +When using autocompletes or search, you often see some highlighted text. This is the component that does that. + + + +## Props + + + +## Customization + +### Default config + +
+
+ + View configuration options + + + + + +
+
+        {JSON.stringify(defaultConfig, null, 2)}
+      
+
+ +
+
diff --git a/src/plugins/components/mark/mark.stories.ts b/src/plugins/components/mark/mark.stories.ts new file mode 100644 index 0000000..53f9f54 --- /dev/null +++ b/src/plugins/components/mark/mark.stories.ts @@ -0,0 +1,25 @@ +import type { Meta, StoryObj } from '@storybook/web-components' +import { html } from 'lit' + +import type { MarkAttrs } from './mark.types' +import { Mark } from './mark.component' + +// More on how to set up stories at: https://storybook.js.org/docs/web-components/writing-stories/introduction +const meta = { + title: 'Shuriken UI/Utility/Mark', + // tags: ['autodocs'], + render: (args) => Mark(args), + argTypes: {}, +} satisfies Meta + +export default meta +type Story = StoryObj + +// first export is the Primary story + +// #region Main +export const Main: Story = { + name: 'Main example', + args: {}, +} +// #endregion diff --git a/src/plugins/components/mark/mark.types.ts b/src/plugins/components/mark/mark.types.ts new file mode 100644 index 0000000..b343886 --- /dev/null +++ b/src/plugins/components/mark/mark.types.ts @@ -0,0 +1,10 @@ +import type { PropertyVariant } from '~/types/utils' + +export interface MarkProps extends Record {} + +export interface MarkEvents {} + +export interface MarkSlots {} + +export type MarkAttrs = MarkProps & MarkEvents & MarkSlots +export type MarkVariant = PropertyVariant diff --git a/src/plugins/components/mark/mark.variants.ts b/src/plugins/components/mark/mark.variants.ts new file mode 100644 index 0000000..336ce12 --- /dev/null +++ b/src/plugins/components/mark/mark.variants.ts @@ -0,0 +1 @@ +export {}