Merged in chore/sw-3145-move-switch (pull request #2521)

Move Switch to design-system

* Move Switch to design-system

* Fix Icon import

* Fix Caption import...


Approved-by: Joakim Jäderberg
This commit is contained in:
Anton Gunnarsson
2025-07-04 08:33:04 +00:00
parent c3279ec254
commit d7981eae42
5 changed files with 13 additions and 17 deletions

View File

@@ -8,6 +8,7 @@ import Body from "@scandic-hotels/design-system/Body"
import Caption from "@scandic-hotels/design-system/Caption"
import Checkbox from "@scandic-hotels/design-system/Form/Checkbox"
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
import Switch from "@scandic-hotels/design-system/Switch"
import { Typography } from "@scandic-hotels/design-system/Typography"
import { SEARCH_TYPE_REDEMPTION } from "@scandic-hotels/trpc/constants/booking"
@@ -15,7 +16,6 @@ import Modal from "@/components/Modal"
import Button from "@/components/TempDesignSystem/Button"
import Input from "@/components/TempDesignSystem/Form/Input"
import { getErrorMessage } from "@/components/TempDesignSystem/Form/Input/errors"
import Switch from "@/components/TempDesignSystem/Form/Switch"
import { Input as BookingWidgetInput } from "../Input"
import { isMultiRoomError } from "../utils"

View File

@@ -1,7 +0,0 @@
import type { RegisterOptions } from "react-hook-form"
export interface SwitchProps
extends React.InputHTMLAttributes<HTMLInputElement> {
name: string
registerOptions?: RegisterOptions
}

View File

@@ -1,14 +1,16 @@
"use client"
'use client'
import { Switch as AriaSwitch } from "react-aria-components"
import { useController, useFormContext } from "react-hook-form"
import { Switch as AriaSwitch } from 'react-aria-components'
import { RegisterOptions, useController, useFormContext } from 'react-hook-form'
import Caption from "@scandic-hotels/design-system/Caption"
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
import styles from './switch.module.css'
import { MaterialIcon } from '../Icons/MaterialIcon'
import Caption from '../Caption'
import styles from "./switch.module.css"
import type { SwitchProps } from "@/types/components/switch"
interface SwitchProps extends React.InputHTMLAttributes<HTMLInputElement> {
name: string
registerOptions?: RegisterOptions
}
export default function Switch({
className,

View File

@@ -17,7 +17,7 @@
display: block;
&:before {
content: "";
content: '';
display: block;
margin: 2px;
width: 16px;

View File

@@ -20,6 +20,7 @@
"./Select": "./dist/components/Select/index.js",
"./SkeletonShimmer": "./dist/components/SkeletonShimmer/index.js",
"./Subtitle": "./dist/components/Subtitle/index.js",
"./Switch": "./dist/components/Switch/index.js",
"./Title": "./dist/components/Title/index.js",
"./Tooltip": "./dist/components/Tooltip/index.js",
"./Typography": "./dist/components/Typography/index.js",