Skip to content

Commit

Permalink
Merge branch 'v2' into tonnam/feat(v2)/radio-button
Browse files Browse the repository at this point in the history
  • Loading branch information
leomotors authored Oct 27, 2024
2 parents b068d4c + d5788d6 commit 22b6545
Show file tree
Hide file tree
Showing 11 changed files with 1,023 additions and 926 deletions.
4 changes: 2 additions & 2 deletions apps/analytics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"@cugetreg/database": "workspace:*",
"dotenv-cli": "^7.4.2",
"drizzle-orm": "^0.34.1",
"postgres": "^3.4.4",
"tsx": "^4.19.1"
"postgres": "^3.4.5",
"tsx": "^4.19.2"
},
"devDependencies": {
"typescript": "^5.6.3"
Expand Down
30 changes: 15 additions & 15 deletions apps/storybook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,26 @@
"@repo/ui": "workspace:*"
},
"devDependencies": {
"@storybook/addon-a11y": "^8.3.5",
"@storybook/addon-essentials": "^8.3.5",
"@storybook/addon-interactions": "^8.3.5",
"@storybook/addon-links": "^8.3.5",
"@storybook/addon-a11y": "^8.3.6",
"@storybook/addon-essentials": "^8.3.6",
"@storybook/addon-interactions": "^8.3.6",
"@storybook/addon-links": "^8.3.6",
"@storybook/addon-svelte-csf": "^4.1.7",
"@storybook/addon-themes": "^8.3.5",
"@storybook/blocks": "^8.3.5",
"@storybook/svelte": "^8.3.5",
"@storybook/svelte-vite": "^8.3.5",
"@storybook/test": "^8.3.5",
"@storybook/addon-themes": "^8.3.6",
"@storybook/blocks": "^8.3.6",
"@storybook/svelte": "^8.3.6",
"@storybook/svelte-vite": "^8.3.6",
"@storybook/test": "^8.3.6",
"@sveltejs/vite-plugin-svelte": "^3.1.2",
"@tsconfig/svelte": "^5.0.4",
"eslint": "^9.12.0",
"sass-embedded": "^1.79.5",
"storybook": "^8.3.5",
"eslint": "^9.13.0",
"sass-embedded": "^1.80.4",
"storybook": "^8.3.6",
"svelte": "^4.2.19",
"svelte-check": "^4.0.5",
"tailwindcss": "^3.4.13",
"tslib": "^2.7.0",
"tailwindcss": "^3.4.14",
"tslib": "^2.8.0",
"typescript": "^5.6.3",
"vite": "^5.4.8"
"vite": "^5.4.10"
}
}
21 changes: 10 additions & 11 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview",
"test": "npm run test:integration && npm run test:unit",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "eslint .",
Expand All @@ -19,24 +18,24 @@
"@repo/ui": "workspace:*"
},
"devDependencies": {
"@playwright/test": "^1.48.0",
"@playwright/test": "^1.48.2",
"@repo/config": "workspace:^",
"@sveltejs/adapter-auto": "^3.2.5",
"@sveltejs/kit": "^2.7.0",
"@sveltejs/adapter-auto": "^3.3.1",
"@sveltejs/kit": "^2.7.3",
"@sveltejs/vite-plugin-svelte": "^3.1.2",
"@typescript-eslint/eslint-plugin": "^8.8.1",
"@typescript-eslint/parser": "^8.8.1",
"@typescript-eslint/eslint-plugin": "^8.11.0",
"@typescript-eslint/parser": "^8.11.0",
"autoprefixer": "^10.4.20",
"eslint": "^9.12.0",
"eslint": "^9.13.0",
"postcss": "^8.4.47",
"prettier": "^3.3.3",
"prettier-plugin-svelte": "^3.2.7",
"svelte": "^4.2.19",
"svelte-check": "^4.0.5",
"tailwindcss": "^3.4.13",
"tslib": "^2.7.0",
"tailwindcss": "^3.4.14",
"tslib": "^2.8.0",
"typescript": "^5.6.3",
"vite": "^5.4.8",
"vitest": "^2.1.2"
"vite": "^5.4.10",
"vitest": "^2.1.3"
}
}
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
"@changesets/cli": "^2.27.9",
"@repo/config": "workspace:^",
"@types/eslint": "^9.6.1",
"eslint": "^9.12.0",
"eslint": "^9.13.0",
"prettier": "^3.3.3",
"turbo": "^2.1.3"
"turbo": "^2.2.3"
},
"packageManager": "[email protected].1"
"packageManager": "[email protected].2"
}
14 changes: 7 additions & 7 deletions packages/config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,24 @@
"format": "eslint . --fix"
},
"dependencies": {
"@typescript-eslint/eslint-plugin": "^8.8.1",
"@typescript-eslint/parser": "^8.8.1",
"@typescript-eslint/eslint-plugin": "^8.11.0",
"@typescript-eslint/parser": "^8.11.0",
"eslint-config-prettier": "^9.1.0",
"eslint-config-turbo": "^2.1.3",
"eslint-config-turbo": "^2.2.3",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-simple-import-sort": "^12.1.1",
"eslint-plugin-svelte": "^2.44.1",
"eslint-plugin-svelte": "^2.46.0",
"eslint-plugin-unused-imports": "^4.1.4",
"prettier": "^3.3.3",
"prettier-plugin-svelte": "^3.2.7"
},
"devDependencies": {
"@eslint/js": "^9.12.0",
"@eslint/js": "^9.13.0",
"@types/eslint": "^9.6.1",
"@types/eslint__js": "^8.42.3",
"eslint": "^9.12.0",
"eslint": "^9.13.0",
"globals": "^15.11.0",
"typescript": "^5.6.3",
"typescript-eslint": "^8.8.1"
"typescript-eslint": "^8.11.0"
}
}
6 changes: 3 additions & 3 deletions packages/database/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
"dependencies": {
"@paralleldrive/cuid2": "^2.2.2",
"drizzle-orm": "^0.34.1",
"postgres": "^3.4.4"
"postgres": "^3.4.5"
},
"devDependencies": {
"@types/cli-progress": "^3.11.6",
"@types/node": "^20.16.11",
"@types/node": "^20.17.1",
"cli-progress": "^3.12.0",
"dotenv-cli": "^7.4.2",
"drizzle-kit": "^0.25.0",
"tsx": "^4.19.1",
"tsx": "^4.19.2",
"typescript": "^5.6.3"
}
}
12 changes: 6 additions & 6 deletions packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@
"devDependencies": {
"@repo/config": "workspace:^",
"@storybook/addon-svelte-csf": "^4.1.7",
"@storybook/svelte": "^8.3.5",
"@sveltejs/adapter-node": "^5.2.6",
"@sveltejs/kit": "^2.7.0",
"@storybook/svelte": "^8.3.6",
"@sveltejs/adapter-node": "^5.2.9",
"@sveltejs/kit": "^2.7.3",
"@sveltejs/vite-plugin-svelte": "^3.1.2",
"svelte": "^4.2.19",
"vitest": "^2.1.2"
"vitest": "^2.1.3"
},
"dependencies": {
"bits-ui": "^0.21.16",
"clsx": "^2.1.1",
"lucide-svelte": "^0.452.0",
"tailwind-merge": "^2.5.3",
"tailwind-merge": "^2.5.4",
"tailwind-variants": "^0.2.1",
"tailwindcss": "^3.4.13"
"tailwindcss": "^3.4.14"
}
}
7 changes: 7 additions & 0 deletions packages/ui/src/components/switch/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Root from './switch.svelte'

export {
Root,
//
Root as Switch,
}
92 changes: 92 additions & 0 deletions packages/ui/src/components/switch/switch.stories.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<script context="module" lang="ts">
import type { Meta } from '@storybook/svelte'
import { Switch } from './index.js'
export const meta = {
title: 'Atom/Switch',
component: Switch,
tags: ['autodocs'],
argTypes: {
'aria-label': {
control: 'text',
description: 'string value that labels an interactive element',
},
checked: {
control: 'boolean',
description: 'Whether the switch is checked or not.',
defaultValue: false,
},
label: {
control: 'text',
description: 'The label associated with the switch.',
defaultValue: 'Switch Label',
},
id: {
control: 'text',
description: 'ID for the switch element and its label.',
defaultValue: 'switch',
},
class: {
control: false,
},
'on:click': {
action: 'onClick',
},
'on:keydown': {
action: 'onKeyDown',
},
},
} satisfies Meta<Switch>
</script>

<script lang="ts">
import { Story, Template } from '@storybook/addon-svelte-csf'
</script>

<!-- Define the template for the switch component -->
<Template let:args>
<Switch {...args} />
</Template>

<!-- Define the stories with different states -->
<Story
name="Default"
args="{{
checked: false,
label: 'Switch Label',
id: 'switch',
'aria-label': 'for example of default switch',
}}"
/>

<Story
name="Checked"
args="{{
checked: true,
label: 'Checked Switch',
id: 'checked-switch',
'aria-label': 'for example of checked switch ',
}}"
/>

<Story
name="With Custom Label"
args="{{
checked: false,
label: 'Custom Label',
id: 'custom-switch',
'aria-label': 'for example of custom label switch ',
}}"
/>

<Story
name="Disabled"
args="{{
checked: false,
label: 'Disabled Switch',
id: 'disabled-switch',
disabled: true,
'aria-label': 'for example of disable switch ',
}}"
/>
44 changes: 44 additions & 0 deletions packages/ui/src/components/switch/switch.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<script lang="ts">
import { Label, Switch as SwitchPrimitive } from 'bits-ui'
import { cn } from '../../utils'
type $$Props = SwitchPrimitive.Props & {
label?: string | undefined | null
}
type $$Events = SwitchPrimitive.Events
let className: $$Props['class'] = undefined
export let checked: $$Props['checked'] = undefined
export let id: $$Props['id'] = null
export let label: $$Props['label'] = 'label'
export { className as class }
</script>

<div class="flex items-center space-x-2">
<SwitchPrimitive.Root
bind:checked
class="{cn(
'focus-visible:ring-ring focus-visible:ring-offset-background data-[state=checked]:border-primary data-[state=checked]:bg-primary-low data-[state=unchecked]:bg-surface-container-lowest peer inline-flex h-[18px] w-[32px] shrink-0 cursor-pointer items-center rounded-full border border-surface-container-high transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50',
className,
)}"
{...$$restProps}
on:click
on:keydown
{id}
>
<SwitchPrimitive.Thumb
class="{cn(
'p-1 bg-surface-container-high data-[state=checked]:bg-primary pointer-events-none block h-3.5 w-3.5 rounded-full shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-[14.5px] data-[state=unchecked]:translate-x-[1px]',
)}"
/>
</SwitchPrimitive.Root>
{#if label}
<Label.Root
for="{id}"
class="text-button2 font-normal leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
>
{label}
</Label.Root>
{/if}
</div>
Loading

0 comments on commit 22b6545

Please sign in to comment.