-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f45bd25
commit f9d2022
Showing
11 changed files
with
238 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
'@websublime/vitamin-theme': minor | ||
'@websublime/vitamin-docs': minor | ||
'@websublime/vitamin-ui': minor | ||
--- | ||
|
||
Checkbox element | ||
|
||
Checkbox with checkmark and readjust ui development script for styling with tailwind. Page is now able to use tailwind without affecting elements styles |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import { withActions } from '@storybook/addon-actions/decorator'; | ||
import type { Meta, StoryObj } from '@storybook/web-components'; | ||
import { CheckboxElement } from '@websublime/vitamin-ui/element/checkbox.js'; | ||
import { html } from 'lit'; | ||
import { repeat } from 'lit/directives/repeat.js'; | ||
|
||
import { registerComponents } from '../loader.js'; | ||
|
||
registerComponents(); | ||
|
||
type Story = StoryObj; | ||
|
||
/** | ||
* # Switch stories | ||
* These stories showcase the switch | ||
*/ | ||
const meta: Meta<CheckboxElement> = { | ||
argTypes: { | ||
checked: { | ||
control: 'boolean', | ||
defaultValue: false, | ||
description: 'Property to set default checked state' | ||
} | ||
}, | ||
component: 'ui-checkbox', | ||
// rome-ignore lint/suspicious/noExplicitAny: <explanation> | ||
decorators: [withActions as any], | ||
parameters: { | ||
actions: { | ||
handles: ['change'] | ||
} | ||
}, | ||
tags: ['autodocs'], | ||
title: 'Elements/Checkbox' | ||
}; | ||
|
||
export default meta; | ||
|
||
/** | ||
* # Simple Checkbox | ||
* Checkbox with no label | ||
*/ | ||
export const Checkbox: Story = { | ||
args: { checked: false }, | ||
render: ({ checked }) => html`<ui-checkbox .checked="${checked}"></ui-checkbox>` | ||
}; | ||
|
||
/** | ||
* # Styling Checkbox | ||
* How to style Checkbox. Css variables are present in .ui-checkbox class. | ||
*/ | ||
export const CheckboxStyle: Story = { | ||
render: () => html` | ||
<style> | ||
.switch-props { | ||
--checkbox-checked-color: theme('colors.grey-dark'); | ||
--checkbox-background-color: theme('colors.white'); | ||
--checkbox-hover-color: theme('colors.grey-dark'); | ||
--checkbox-diameter: 20px; | ||
--checkbox-border-radius: 5px; | ||
--checkbox-border-color: theme('colors.grey'); | ||
--checkbox-border-width: 1px; | ||
--checkbox-border-style: solid; | ||
--checkbox-checkmark-size: 1.2; | ||
} | ||
</style> | ||
<p>See show code</p> | ||
` | ||
}; | ||
|
||
/** | ||
* # Label Checkbox | ||
* Checkbox with label | ||
*/ | ||
export const CheckboxLabel: Story = { | ||
args: {}, | ||
render: ({ name }) => | ||
html` <ui-checkbox><span class="text-black dark:text-white" slot="label">Checked</span></ui-checkbox> ` | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
import { registerComponent as registerCheckbox } from '@websublime/vitamin-ui/plugin/checkbox.js'; | ||
import { registerComponent as registerIcon } from '@websublime/vitamin-ui/plugin/icon.js'; | ||
import { registerComponent as registerSwitch } from '@websublime/vitamin-ui/plugin/switch.js'; | ||
|
||
export function registerComponents() { | ||
customElements.get('ui-icon') || registerIcon(); | ||
customElements.get('ui-switch') || registerSwitch(); | ||
customElements.get('ui-checkbox') || registerCheckbox(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
@tailwind base; | ||
@tailwind utilities; | ||
@tailwind components; | ||
|
||
@layer base { | ||
body { | ||
--font-size: 16px; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters