@propellerads/switch 5.0.2 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,35 +1,90 @@
1
1
  # Switch
2
2
 
3
+ An on/off switch. Version 6 is shadcn's switch on
4
+ [Base UI](https://base-ui.com/react/components/switch), in the library's look:
5
+ one stylesheet, every colour, corner and duration from
6
+ [@propellerads/tokens](../Tokens/README.md).
7
+
3
8
  ![](https://img.shields.io/npm/v/@propellerads/switch.svg?style=flat-square)
4
9
 
5
- Links: [NPM](https://www.npmjs.com/package/@propellerads/switch) · [GitHub](https://github.com/propellerads/ui-components/tree/master/Components/Switch)
10
+ [NPM](https://www.npmjs.com/package/@propellerads/switch) |
11
+ [Github](https://github.com/propellerads/ui-components/tree/master/Components/Switch)
12
+
13
+ ## Installation
14
+
15
+ ```sh
16
+ bun add @propellerads/switch
17
+ ```
18
+
19
+ The built entry imports its own stylesheet. The tokens are the app's:
6
20
 
7
- ## Install
21
+ ```ts
22
+ import '@propellerads/tokens/common.css';
23
+ import '@propellerads/tokens/propellerads.css'; // or monetag / propush / zeydoo
24
+ ```
8
25
 
9
- - `bun add @propellerads/switch`
10
- or
11
- - `npm install @propellerads/switch --save`
26
+ ## Use
12
27
 
13
- ## Usage
28
+ v5's props work as they did:
14
29
 
15
30
  ```tsx
16
31
  import Switch from '@propellerads/switch';
17
32
 
33
+ <Switch elementId="auto-refill" isActive={isOn} onChange={setOn} />
34
+ <Switch elementId="reports" isActive={isOn} onChange={setOn} label="Send weekly reports" />
35
+ <Switch elementId="status" isActive={isOn} onChange={setOn} isDisabled aria-label="Creative status" />
18
36
  <Switch
19
- isActive={true}
20
- onChange={(next) => console.log('changed:', next)}
21
- elementId="switch-id"
22
- isDisabled={false}
23
- containerClassName="my-root"
24
- controlClassName="my-control"
25
- />;
37
+ elementId="terms"
38
+ isActive={accepted}
39
+ onChange={setAccepted}
40
+ labelPlacement="start"
41
+ isInvalid={!accepted}
42
+ label="Accept terms and conditions"
43
+ description="You must accept the terms and conditions to continue."
44
+ />
26
45
  ```
27
46
 
47
+ ## How it behaves
48
+
49
+ - It is a `role="switch"` button: Space and Enter toggle it, and a screen reader
50
+ hears on or off.
51
+ - The track keeps v5's 40 by 20 pixels, so a screen laid out around the old
52
+ switch does not move.
53
+ - The thumb slides in `--duration-200` and stretches under a press — v5's squash
54
+ on toggle, made into the moment the finger is down.
55
+ - `elementId` lands on the hidden checkbox Base UI renders beside the button, as
56
+ it landed on v5's hidden checkbox, and a `label` beside the switch is tied to
57
+ it.
58
+
28
59
  ## Props
29
60
 
30
- - isActive (boolean, required): current switch value
31
- - onChange (function, required): called with next `boolean` value
32
- - elementId (string): id to link `input` and `label`
33
- - isDisabled (boolean, default: false): disables the control
34
- - containerClassName (string): custom class for root container
35
- - controlClassName (string): custom class for inner control
61
+ | Prop | Type | Default | What it does |
62
+ |----------------------|-----------------------------|---------|-------------------------------------------------|
63
+ | `isActive` | `boolean` | — | On or off. Controlled |
64
+ | `onChange` | `(nextValue) => void` | — | Called with the value it is turning to |
65
+ | `elementId` | `string` | — | The switch's id, as in v5 |
66
+ | `isDisabled` | `boolean` | `false` | Fades the switch and stops it answering |
67
+ | `containerClassName` | `string` | — | On the outer box, as in v5 |
68
+ | `controlClassName` | `string` | — | On the box around the track, as in v5 |
69
+ | `label` | `ReactNode` | — | Text beside the switch; a click on it toggles |
70
+ | `description` | `ReactNode` | — | A line under the label; the switch is described by it |
71
+ | `labelPlacement` | `'end' \| 'start'` | `'end'` | `start`: the text first, the switch at the end of the row |
72
+ | `isInvalid` | `boolean` | `false` | A danger ring round the track, the label in danger, `aria-invalid` |
73
+ | `aria-label` | `string` | — | Names the switch when there is no label |
74
+ | `name` | `string` | — | Submits the value with a form |
75
+ | `inputRef` | `Ref<HTMLInputElement>` | — | The hidden checkbox |
76
+
77
+ ## Tokens
78
+
79
+ | What | Token |
80
+ |-------------|-----------------------------------------------------------|
81
+ | Track, off | `--color-rich`, hover deepened with `--over-deepen` |
82
+ | Track, on | `--color-action`, hover deepened |
83
+ | Thumb | `--color-light`, `--shadow-little` |
84
+ | Focus ring | `--color-action`, 2px, offset 1px — the button's |
85
+ | Disabled | `--opacity-disabled` |
86
+ | Invalid | ring `--color-danger`, label `--color-danger-text` |
87
+ | Description | `--font-description`, `--color-quiet-text` |
88
+ | Motion | `--duration-200` slide, `--duration-100` stretch |
89
+
90
+ The accent is an override point: `--switch-accent` on any ancestor.
package/dist/index.css ADDED
@@ -0,0 +1 @@
1
+ .switch{--switch-accent:var(--color-action);--switch-width:40px;--switch-height:20px;--switch-inset:var(--space-2);--switch-thumb:calc(var(--switch-height) - 2 * var(--switch-inset));align-items:center;gap:var(--space-8);display:flex}.switch[data-label-placement=start]{flex-direction:row-reverse;justify-content:space-between}.switch:has(.switch__description){align-items:flex-start}.switch__control{flex:none;display:inline-flex}.switch__track{box-sizing:border-box;width:var(--switch-width);height:var(--switch-height);margin:var(--space-0);padding:var(--switch-inset);border-radius:calc(var(--switch-height) / 2);background-color:var(--color-rich);outline:var(--space-2) solid transparent;outline-offset:var(--space-1);cursor:pointer;transition:background-color var(--duration-200) var(--ease-flat), outline-color var(--duration-200) var(--ease-flat);border:0;align-items:center;display:inline-flex;position:relative}.switch__track[data-checked]{background-color:var(--switch-accent)}.switch__track:hover{background-color:color-mix(in srgb, var(--over-deepen), var(--color-rich))}.switch__track[data-checked]:hover{background-color:color-mix(in srgb, var(--over-deepen), var(--switch-accent))}.switch__track:focus-visible{outline-color:var(--color-action)}.switch__track[data-disabled]{opacity:var(--opacity-disabled);cursor:not-allowed}.switch__track[data-disabled]:hover{background-color:var(--color-rich)}.switch__track[data-disabled][data-checked]:hover{background-color:var(--switch-accent)}.switch__thumb{width:var(--switch-thumb);height:var(--switch-thumb);border-radius:calc(var(--switch-thumb) / 2);background-color:var(--color-light);box-shadow:var(--shadow-little);transition:transform var(--duration-200) var(--ease-enter), width var(--duration-100) var(--ease-enter);display:block}.switch__thumb[data-checked]{transform:translateX(calc(var(--switch-width) - var(--switch-thumb) - 2 * var(--switch-inset)))}.switch__track:active:not([data-disabled]) .switch__thumb{width:calc(var(--switch-thumb) + var(--space-4))}.switch__track:active:not([data-disabled]) .switch__thumb[data-checked]{transform:translateX(calc(var(--switch-width) - var(--switch-thumb) - var(--space-4) - 2 * var(--switch-inset)))}.switch__text{gap:var(--space-2);flex-direction:column;min-width:0;display:flex}.switch__label{color:var(--color-dark-inversion);font:var(--font-text);font-family:var(--font-family);cursor:pointer}.switch__description{color:var(--color-quiet-text);font:var(--font-description);font-family:var(--font-family)}.switch[data-invalid] .switch__track,.switch[data-invalid] .switch__track:focus-visible{outline-color:var(--color-danger)}.switch[data-invalid] .switch__label{color:var(--color-danger-text)}.switch[data-disabled] .switch__label,.switch[data-disabled] .switch__description{opacity:var(--opacity-disabled);cursor:not-allowed}
package/dist/index.d.ts CHANGED
@@ -1,14 +1,39 @@
1
- import React from 'react';
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactNode, Ref } from 'react';
2
3
 
3
4
  type SwitchProps = {
5
+ /** On or off. Controlled by the caller. */
4
6
  isActive: boolean;
7
+ /** Called with the value the switch is turning to. */
5
8
  onChange: (nextValue: boolean) => void;
9
+ /** On the outer box, as in v5. */
6
10
  containerClassName?: string;
11
+ /** On the box around the track, as in v5. */
7
12
  controlClassName?: string;
13
+ /** The switch's id, as in v5: products and tests find it by it. */
8
14
  elementId?: string;
9
15
  isDisabled?: boolean;
16
+ /** Text beside the switch; a click on it toggles the switch. */
17
+ label?: ReactNode;
18
+ /** A line under the label. The switch is described by it. */
19
+ description?: ReactNode;
20
+ /** Which side the label stands on. `start` puts it first and the switch at the end of the row. @default 'end' */
21
+ labelPlacement?: 'start' | 'end';
22
+ /** Marks the switch invalid: a danger ring round the track, the label in danger, `aria-invalid`. */
23
+ isInvalid?: boolean;
24
+ /** Names the switch when there is no `label`. */
25
+ 'aria-label'?: string;
26
+ /** Submits the value with a form under this name. */
27
+ name?: string;
28
+ /** The hidden checkbox Base UI renders for forms. */
29
+ inputRef?: Ref<HTMLInputElement>;
10
30
  };
11
- declare const Switch: React.FC<SwitchProps>;
31
+ /**
32
+ * shadcn's switch on Base UI: a `role="switch"` button, Space and Enter toggle
33
+ * it. The track stays v5's 40 by 20 pixels, so a screen laid out around the old
34
+ * switch does not move.
35
+ */
36
+ declare const Switch: ({ isActive, onChange, containerClassName, controlClassName, elementId, isDisabled, label, description, labelPlacement, isInvalid, "aria-label": ariaLabel, name, inputRef, }: SwitchProps) => react_jsx_runtime.JSX.Element;
12
37
 
13
- export { Switch as default };
38
+ export { Switch, Switch as default };
14
39
  export type { SwitchProps };
package/dist/index.js CHANGED
@@ -1,97 +1,45 @@
1
- import "react";
2
- import e, { keyframes as t } from "styled-components";
3
- import { actionColor as n, black as r, fontSmall as i, gray50 as a, gray95 as o, hslToHsla as s } from "@propellerads/stylevariables";
4
- import { jsx as c, jsxs as l } from "react/jsx-runtime";
5
- //#region src/style.tsx
6
- var u = t`
7
- 50% {
8
- transform: scaleX(1.1);
9
- }
10
- `, d = s(r, "0.15"), f = s(r, "0.5"), p = s(n, "0.5"), m = e.div`
11
- display: flex;
12
- align-items: center;
13
- `, h = e.div`
14
- display: block;
15
- font-size: ${i}px;
16
- color: ${a};
17
-
18
- label {
19
- position: relative;
20
- display: block;
21
- width: 40px;
22
- height: 20px;
23
- cursor: pointer;
24
-
25
- &:before {
26
- position: absolute;
27
- width: 40px;
28
- height: 20px;
29
- content: '';
30
- transition: background 0.1s ease;
31
- border-radius: 50px;
32
- background: ${o};
33
- box-shadow: inset 0 0 3px ${d};
34
- }
35
-
36
- &:after {
37
- position: absolute;
38
- z-index: 2;
39
- top: 4px;
40
- left: 4px;
41
- width: 12px;
42
- height: 12px;
43
- content: '';
44
- transition: all 0.2s ease;
45
- animation: ${u} 0.3s ease-out;
46
- border-radius: 50px;
47
- background: white;
48
- box-shadow: 0 0 3px 0 ${f};
49
- }
50
- }
51
-
52
- input {
53
- &[type='checkbox'] {
54
- display: none;
55
- visibility: hidden;
56
-
57
- &:disabled + label {
58
- cursor: not-allowed;
59
- }
60
-
61
- &:checked + label:before {
62
- background: ${(e) => e?.theme?.actionColor?.main || n};
63
- box-shadow: inset 0 0 1px ${p};
64
- }
65
-
66
- &:checked + label:after {
67
- left: 24px;
68
- animation: ${u} 0.2s ease-out;
69
- }
70
-
71
- &:checked:disabled + label:before {
72
- background: ${(e) => s(e?.theme?.actionColor?.main || n, "0.3")};
73
- }
74
- }
75
- }
76
- `, g = ({ isActive: e, onChange: t, containerClassName: n, controlClassName: r, elementId: i, isDisabled: a = !1 }) => /* @__PURE__ */ c(m, {
77
- className: n,
78
- children: /* @__PURE__ */ l(h, {
79
- className: r,
80
- children: [/* @__PURE__ */ c("input", {
81
- type: "checkbox",
82
- checked: e,
83
- onChange: () => {
84
- t(!e);
85
- },
86
- id: i,
87
- disabled: a
88
- }), /* @__PURE__ */ c("label", {
89
- htmlFor: i,
90
- role: "presentation"
1
+ import { Switch as e } from "@base-ui-components/react/switch";
2
+ import { useId as t } from "react";
3
+ import { clsx as n } from "clsx";
4
+ import { jsx as r, jsxs as i } from "react/jsx-runtime";
5
+ import './index.css';//#region src/cn.ts
6
+ var a = (...e) => n(e), o = ({ isActive: n, onChange: o, containerClassName: s, controlClassName: c, elementId: l, isDisabled: u = !1, label: d, description: f, labelPlacement: p = "end", isInvalid: m = !1, "aria-label": h, name: g, inputRef: _ }) => {
7
+ let v = t(), y = l ?? v, b = `${y}-description`, x = d !== void 0 || f !== void 0;
8
+ return /* @__PURE__ */ i("div", {
9
+ className: a("switch", s),
10
+ "data-disabled": u || void 0,
11
+ "data-invalid": m || void 0,
12
+ "data-label-placement": p,
13
+ children: [/* @__PURE__ */ r("span", {
14
+ className: a("switch__control", c),
15
+ children: /* @__PURE__ */ r(e.Root, {
16
+ id: y,
17
+ className: "switch__track",
18
+ checked: n,
19
+ onCheckedChange: (e) => o(e),
20
+ disabled: u,
21
+ name: g,
22
+ inputRef: _,
23
+ "aria-label": h,
24
+ ...m ? { "aria-invalid": !0 } : {},
25
+ ...f === void 0 ? {} : { "aria-describedby": b },
26
+ children: /* @__PURE__ */ r(e.Thumb, { className: "switch__thumb" })
27
+ })
28
+ }), x && /* @__PURE__ */ i("span", {
29
+ className: "switch__text",
30
+ children: [d !== void 0 && /* @__PURE__ */ r("label", {
31
+ className: "switch__label",
32
+ htmlFor: y,
33
+ children: d
34
+ }), f !== void 0 && /* @__PURE__ */ r("span", {
35
+ id: b,
36
+ className: "switch__description",
37
+ children: f
38
+ })]
91
39
  })]
92
- })
93
- });
40
+ });
41
+ };
94
42
  //#endregion
95
- export { g as default };
43
+ export { o as Switch, o as default };
96
44
 
97
45
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/style.tsx","../src/index.tsx"],"sourcesContent":["import styled, {keyframes} from 'styled-components';\nimport {gray50, gray95, actionColor, black, fontSmall, hslToHsla} from '@propellerads/stylevariables';\n\nconst switchOn = keyframes`\n 50% {\n transform: scaleX(1.1);\n }\n`;\n\nconst black15 = hslToHsla(black, '0.15');\nconst black25 = hslToHsla(black, '0.5');\nconst action50 = hslToHsla(actionColor, '0.5');\n\nconst StyledSwitch = styled.div`\n display: flex;\n align-items: center;\n`;\n\nconst SwitchControl = styled.div`\n display: block;\n font-size: ${fontSmall}px;\n color: ${gray50};\n\n label {\n position: relative;\n display: block;\n width: 40px;\n height: 20px;\n cursor: pointer;\n\n &:before {\n position: absolute;\n width: 40px;\n height: 20px;\n content: '';\n transition: background 0.1s ease;\n border-radius: 50px;\n background: ${gray95};\n box-shadow: inset 0 0 3px ${black15};\n }\n\n &:after {\n position: absolute;\n z-index: 2;\n top: 4px;\n left: 4px;\n width: 12px;\n height: 12px;\n content: '';\n transition: all 0.2s ease;\n animation: ${switchOn} 0.3s ease-out;\n border-radius: 50px;\n background: white;\n box-shadow: 0 0 3px 0 ${black25};\n }\n }\n\n input {\n &[type='checkbox'] {\n display: none;\n visibility: hidden;\n\n &:disabled + label {\n cursor: not-allowed;\n }\n\n &:checked + label:before {\n background: ${(props) => props?.theme?.actionColor?.main || actionColor};\n box-shadow: inset 0 0 1px ${action50};\n }\n\n &:checked + label:after {\n left: 24px;\n animation: ${switchOn} 0.2s ease-out;\n }\n\n &:checked:disabled + label:before {\n background: ${(props) => hslToHsla(props?.theme?.actionColor?.main || actionColor, '0.3')};\n }\n }\n }\n`;\n\nexport {StyledSwitch, SwitchControl};\n","import React from 'react';\n\nimport {StyledSwitch, SwitchControl} from './style';\n\ntype SwitchProps = {\n isActive: boolean;\n onChange: (nextValue: boolean) => void;\n containerClassName?: string;\n controlClassName?: string;\n elementId?: string;\n isDisabled?: boolean;\n};\n\nconst Switch: React.FC<SwitchProps> = ({\n isActive,\n onChange,\n containerClassName,\n controlClassName,\n elementId,\n isDisabled = false,\n}) => {\n const handleToggleCheckbox = () => {\n onChange(!isActive);\n };\n\n return (\n <StyledSwitch className={containerClassName}>\n <SwitchControl className={controlClassName}>\n <input\n type=\"checkbox\"\n checked={isActive}\n onChange={handleToggleCheckbox}\n id={elementId}\n disabled={isDisabled}\n />\n <label htmlFor={elementId} role=\"presentation\" />\n </SwitchControl>\n </StyledSwitch>\n );\n};\n\nexport default Switch;\n\nexport type {SwitchProps};\n"],"mappings":";;;;;AAGA,IAAM,IAAW,CAAS;;;;GAMpB,IAAU,EAAU,GAAO,OAAO,EAClC,IAAU,EAAU,GAAO,MAAM,EACjC,IAAW,EAAU,GAAa,MAAM,EAExC,IAAe,EAAO,GAAG;;;GAKzB,IAAgB,EAAO,GAAG;;eAEjB,EAAU;WACd,EAAO;;;;;;;;;;;;;;;;oBAgBE,EAAO;kCACO,EAAQ;;;;;;;;;;;;mBAYvB,EAAS;;;8BAGE,EAAQ;;;;;;;;;;;;;;uBAcf,MAAU,GAAO,OAAO,aAAa,QAAQ,EAAY;oCAC5C,EAAS;;;;;qBAKxB,EAAS;;;;uBAIP,MAAU,EAAU,GAAO,OAAO,aAAa,QAAQ,GAAa,MAAM,CAAC;;;;GChE5F,KAAiC,EACrC,aACA,aACA,uBACA,qBACA,cACA,gBAAa,SAOX,kBAAC,GAAD;CAAc,WAAW;WACvB,kBAAC,GAAD;EAAe,WAAW;YAA1B,CACE,kBAAC,SAAD;GACE,MAAK;GACL,SAAS;GACT,gBAV2B;IACjC,EAAS,CAAC,EAAS;;GAUb,IAAI;GACJ,UAAU;GACV,CAAA,EACF,kBAAC,SAAD;GAAO,SAAS;GAAW,MAAK;GAAiB,CAAA,CACnC;;CACH,CAAA"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/cn.ts","../src/index.tsx"],"sourcesContent":["import {type ClassValue, clsx} from 'clsx';\n\n/**\n * Joins class names. There is no tailwind-merge here on purpose: the switch\n * ships its own stylesheet instead of utility classes, so there is nothing to\n * deduplicate.\n */\nconst cn = (...inputs: ClassValue[]): string => clsx(inputs);\n\nexport {cn};\n","import {Switch as BaseSwitch} from '@base-ui-components/react/switch';\nimport {type ReactNode, type Ref, useId} from 'react';\nimport './switch.css';\nimport {cn} from './cn';\n\ntype SwitchProps = {\n /** On or off. Controlled by the caller. */\n isActive: boolean;\n /** Called with the value the switch is turning to. */\n onChange: (nextValue: boolean) => void;\n /** On the outer box, as in v5. */\n containerClassName?: string;\n /** On the box around the track, as in v5. */\n controlClassName?: string;\n /** The switch's id, as in v5: products and tests find it by it. */\n elementId?: string;\n isDisabled?: boolean;\n /** Text beside the switch; a click on it toggles the switch. */\n label?: ReactNode;\n /** A line under the label. The switch is described by it. */\n description?: ReactNode;\n /** Which side the label stands on. `start` puts it first and the switch at the end of the row. @default 'end' */\n labelPlacement?: 'start' | 'end';\n /** Marks the switch invalid: a danger ring round the track, the label in danger, `aria-invalid`. */\n isInvalid?: boolean;\n /** Names the switch when there is no `label`. */\n 'aria-label'?: string;\n /** Submits the value with a form under this name. */\n name?: string;\n /** The hidden checkbox Base UI renders for forms. */\n inputRef?: Ref<HTMLInputElement>;\n};\n\n/**\n * shadcn's switch on Base UI: a `role=\"switch\"` button, Space and Enter toggle\n * it. The track stays v5's 40 by 20 pixels, so a screen laid out around the old\n * switch does not move.\n */\nconst Switch = ({\n isActive,\n onChange,\n containerClassName,\n controlClassName,\n elementId,\n isDisabled = false,\n label,\n description,\n labelPlacement = 'end',\n isInvalid = false,\n 'aria-label': ariaLabel,\n name,\n inputRef,\n}: SwitchProps) => {\n const fallbackId = useId();\n const id = elementId ?? fallbackId;\n const descriptionId = `${id}-description`;\n const hasText = label !== undefined || description !== undefined;\n\n return (\n <div\n className={cn('switch', containerClassName)}\n data-disabled={isDisabled || undefined}\n data-invalid={isInvalid || undefined}\n data-label-placement={labelPlacement}\n >\n <span className={cn('switch__control', controlClassName)}>\n <BaseSwitch.Root\n id={id}\n className=\"switch__track\"\n checked={isActive}\n onCheckedChange={(checked) => onChange(checked)}\n disabled={isDisabled}\n name={name}\n inputRef={inputRef}\n aria-label={ariaLabel}\n {...(isInvalid ? {'aria-invalid': true} : {})}\n {...(description !== undefined ? {'aria-describedby': descriptionId} : {})}\n >\n <BaseSwitch.Thumb className=\"switch__thumb\" />\n </BaseSwitch.Root>\n </span>\n {hasText && (\n <span className=\"switch__text\">\n {label !== undefined && (\n <label className=\"switch__label\" htmlFor={id}>\n {label}\n </label>\n )}\n {description !== undefined && (\n <span id={descriptionId} className=\"switch__description\">\n {description}\n </span>\n )}\n </span>\n )}\n </div>\n );\n};\n\nexport default Switch;\n\nexport type {SwitchProps};\nexport {Switch};\n"],"mappings":";;;;;AAOA,IAAM,KAAM,GAAG,MAAiC,EAAK,EAAO,EC+BtD,KAAU,EACd,aACA,aACA,uBACA,qBACA,cACA,gBAAa,IACb,UACA,gBACA,oBAAiB,OACjB,eAAY,IACZ,cAAc,GACd,SACA,kBACiB;CACjB,IAAM,IAAa,GAAO,EACpB,IAAK,KAAa,GAClB,IAAgB,GAAG,EAAG,eACtB,IAAU,MAAU,KAAA,KAAa,MAAgB,KAAA;CAEvD,OACE,kBAAC,OAAD;EACE,WAAW,EAAG,UAAU,EAAmB;EAC3C,iBAAe,KAAc,KAAA;EAC7B,gBAAc,KAAa,KAAA;EAC3B,wBAAsB;YAJxB,CAME,kBAAC,QAAD;GAAM,WAAW,EAAG,mBAAmB,EAAiB;aACtD,kBAAC,EAAW,MAAZ;IACM;IACJ,WAAU;IACV,SAAS;IACT,kBAAkB,MAAY,EAAS,EAAQ;IAC/C,UAAU;IACJ;IACI;IACV,cAAY;IACZ,GAAK,IAAY,EAAC,gBAAgB,IAAK,GAAG,EAAE;IAC5C,GAAK,MAAgB,KAAA,IAAkD,EAAE,GAAxC,EAAC,oBAAoB,GAAc;cAEpE,kBAAC,EAAW,OAAZ,EAAkB,WAAU,iBAAkB,CAAA;IAC9B,CAAA;GACb,CAAA,EACN,KACC,kBAAC,QAAD;GAAM,WAAU;aAAhB,CACG,MAAU,KAAA,KACT,kBAAC,SAAD;IAAO,WAAU;IAAgB,SAAS;cACvC;IACK,CAAA,EAET,MAAgB,KAAA,KACf,kBAAC,QAAD;IAAM,IAAI;IAAe,WAAU;cAChC;IACI,CAAA,CAEJ;KAEL"}
package/package.json CHANGED
@@ -1,14 +1,19 @@
1
1
  {
2
2
  "name": "@propellerads/switch",
3
- "version": "5.0.2",
3
+ "version": "6.0.0",
4
4
  "type": "module",
5
5
  "types": "dist/index.d.ts",
6
+ "style": "dist/index.css",
6
7
  "exports": {
7
8
  ".": {
8
9
  "types": "./dist/index.d.ts",
9
10
  "import": "./dist/index.js"
10
- }
11
+ },
12
+ "./index.css": "./dist/index.css"
11
13
  },
14
+ "sideEffects": [
15
+ "**/*.css"
16
+ ],
12
17
  "files": [
13
18
  "dist"
14
19
  ],
@@ -24,20 +29,27 @@
24
29
  "homepage": "https://github.com/propellerads/ui-components#readme",
25
30
  "private": false,
26
31
  "dependencies": {
27
- "@propellerads/stylevariables": "workspace:^",
28
- "@propellerads/theme-annotation": "workspace:^"
32
+ "@base-ui-components/react": "1.0.0-rc.0",
33
+ "clsx": "^2.1.1"
29
34
  },
30
35
  "peerDependencies": {
36
+ "@propellerads/tokens": ">=0.2.0",
31
37
  "react": "^18.0.0 || ^19.0.0",
32
- "styled-components": "^5.1.1 || ^6.0.0"
38
+ "react-dom": "^18.0.0 || ^19.0.0"
39
+ },
40
+ "peerDependenciesMeta": {
41
+ "@propellerads/tokens": {
42
+ "optional": true
43
+ }
33
44
  },
34
45
  "devDependencies": {
46
+ "@propellerads/tokens": "workspace:^",
35
47
  "@types/react": "^19.2.14",
36
- "@types/styled-components": "^5.1.36",
37
48
  "@vitejs/plugin-react": "^6.0.1",
38
49
  "rollup": "^4.60.3",
39
50
  "rollup-plugin-dts": "^6.4.1",
40
51
  "typescript": "^6.0.3",
41
- "vite": "^8.0.10"
52
+ "vite": "^8.0.10",
53
+ "vite-plugin-lib-inject-css": "^2.2.2"
42
54
  }
43
55
  }