@softure-ai/theme-notion 0.29.1 → 0.30.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/CHANGELOG.md CHANGED
@@ -4,6 +4,14 @@ Newest first. Each version lists what changed for an app that uses the theme. Wh
4
4
  production, the version gets a line `verified in: <app>@<commit>` ([docs/05](../../docs/05-adoption-playbook.md),
5
5
  "Definition of done").
6
6
 
7
+ ## 0.30.0
8
+
9
+ - Touch-sized `Switch`: `size="touch"` makes the switch a 44 × 44 square (the `touch-target` token, `data-size="touch"`)
10
+ that draws the same 26 × 16 track and 12 px thumb inside it, the focus ring on the track. Negative margins keep the
11
+ switch's place in the layout at the track's size, so a row does not grow; a phone taps the whole square. One
12
+ breakpoint class brings the plain switch back on a desktop (`className="md:m-0 md:h-4 md:w-[26px]"`).
13
+ - Migration: none; the default and `sm` sizes render the same markup as before.
14
+
7
15
  ## 0.29.1
8
16
 
9
17
  - The loading states' counter script (`LaunchScreen`, `TopLoadingBar`, and through them `RouteLoading`) is drawn only
package/README.md CHANGED
@@ -170,7 +170,9 @@ and zoom; one row per document with its type, size and an "available offline" ma
170
170
  (`DropdownMenuContent size="touch"`, or `size="touch"` on a `DropdownMenuItem`, `DropdownMenuCheckboxItem`,
171
171
  `DropdownMenuRadioItem` or `DropdownMenuSubTrigger`) and the tabs (`TabsList size="touch"` grows to its triggers,
172
172
  each at least 44 × 44, or `TabsTrigger size="touch"`). `TabBar size="touch"` draws every tab link at least 44 × 44 (`data-size="touch"`), and its
173
- `tabClassName` goes on every link after the size (`tabClassName="md:h-control-height md:min-w-0"` on a desktop). `AccordionTrigger size="touch"` is at least 44 px high
173
+ `tabClassName` goes on every link after the size (`tabClassName="md:h-control-height md:min-w-0"` on a desktop). `Switch size="touch"` is a 44 × 44 square that draws the same 26 × 16 track
174
+ inside it and keeps the track's place in the layout (negative margins), so a phone taps the whole square; `className="md:m-0
175
+ md:h-4 md:w-[26px]"` brings the plain switch back on a desktop. `AccordionTrigger size="touch"` is at least 44 px high
174
176
  whatever its padding, and `DialogContent closeButtonSize="touch"` draws the close button 44 × 44 around the same
175
177
  icon. Each sets its height with a plain class, so one breakpoint class brings the pointer size back on a desktop.
176
178
 
@@ -1,7 +1,7 @@
1
1
  import * as React from "react";
2
2
  import { Switch as SwitchPrimitive } from "radix-ui";
3
3
  declare function Switch({ className, size, ...props }: React.ComponentProps<typeof SwitchPrimitive.Root> & {
4
- size?: "sm" | "default";
4
+ size?: "sm" | "default" | "touch";
5
5
  }): React.JSX.Element;
6
6
  export { Switch };
7
7
  //# sourceMappingURL=switch.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../../src/ui/switch.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,UAAU,CAAA;AAEpD,iBAAS,MAAM,CAAC,EACd,SAAS,EACT,IAAgB,EAChB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,IAAI,CAAC,GAAG;IACrD,IAAI,CAAC,EAAE,IAAI,GAAG,SAAS,CAAA;CACxB,qBAoBA;AAED,OAAO,EAAE,MAAM,EAAE,CAAA"}
1
+ {"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../../src/ui/switch.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,UAAU,CAAA;AASpD,iBAAS,MAAM,CAAC,EACd,SAAS,EACT,IAAgB,EAChB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,IAAI,CAAC,GAAG;IACrD,IAAI,CAAC,EAAE,IAAI,GAAG,SAAS,GAAG,OAAO,CAAA;CAClC,qBAsBA;AAED,OAAO,EAAE,MAAM,EAAE,CAAA"}
package/dist/ui/switch.js CHANGED
@@ -4,8 +4,13 @@ import * as React from "react";
4
4
  import { cn } from "../lib/utils.js";
5
5
  import { SWITCH_THUMB_SHADOW_CLASS } from "./switch-thumb.js";
6
6
  import { Switch as SwitchPrimitive } from "radix-ui";
7
+ // The touch size: the root is the touch target (44 × 44) and draws the same 26 × 16 track inside it, so a phone taps
8
+ // the whole square; negative margins keep the switch's place in the layout at the track's size.
9
+ const TOUCH_ROOT_CLASS = "relative -mx-[calc((var(--spacing-touch-target)-26px)/2)] -my-[calc((var(--spacing-touch-target)-16px)/2)] size-touch-target justify-center data-[state=checked]:bg-transparent data-[state=unchecked]:bg-transparent focus-visible:ring-0 before:absolute before:top-1/2 before:left-1/2 before:h-4 before:w-[26px] before:-translate-x-1/2 before:-translate-y-1/2 before:rounded-full before:transition-all data-[state=checked]:before:bg-primary data-[state=unchecked]:before:bg-control-off focus-visible:before:ring-2 focus-visible:before:ring-ring";
10
+ // The thumb sits centred in the square, so it moves 5 px either side of the centre: the track's 2 px inset at each end.
11
+ const TOUCH_THUMB_CLASS = "relative size-3 data-[state=checked]:translate-x-[5px] data-[state=unchecked]:-translate-x-[5px]";
7
12
  function Switch({ className, size = "default", ...props }) {
8
- return (_jsx(SwitchPrimitive.Root, { "data-slot": "switch", "data-size": size, className: cn("peer group/switch inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-4 data-[size=default]:w-[26px] data-[size=default]:p-0.5 data-[size=sm]:h-3.5 data-[size=sm]:w-[22px] data-[size=sm]:p-0.5 data-[state=checked]:bg-primary data-[state=unchecked]:bg-control-off", className), ...props, children: _jsx(SwitchPrimitive.Thumb, { "data-slot": "switch-thumb", className: cn("pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-3 group-data-[size=sm]/switch:size-2.5 data-[state=checked]:translate-x-[10px] data-[state=unchecked]:translate-x-0", SWITCH_THUMB_SHADOW_CLASS) }) }));
13
+ return (_jsx(SwitchPrimitive.Root, { "data-slot": "switch", "data-size": size, className: cn("peer group/switch inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-4 data-[size=default]:w-[26px] data-[size=default]:p-0.5 data-[size=sm]:h-3.5 data-[size=sm]:w-[22px] data-[size=sm]:p-0.5 data-[state=checked]:bg-primary data-[state=unchecked]:bg-control-off", size === "touch" && TOUCH_ROOT_CLASS, className), ...props, children: _jsx(SwitchPrimitive.Thumb, { "data-slot": "switch-thumb", className: cn("pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-3 group-data-[size=sm]/switch:size-2.5 data-[state=checked]:translate-x-[10px] data-[state=unchecked]:translate-x-0", SWITCH_THUMB_SHADOW_CLASS, size === "touch" && TOUCH_THUMB_CLASS) }) }));
9
14
  }
10
15
  export { Switch };
11
16
  //# sourceMappingURL=switch.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"switch.js","sourceRoot":"","sources":["../../src/ui/switch.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAA;AACpC,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAA;AAC7D,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,UAAU,CAAA;AAEpD,SAAS,MAAM,CAAC,EACd,SAAS,EACT,IAAI,GAAG,SAAS,EAChB,GAAG,KAAK,EAGT;IACC,OAAO,CACL,KAAC,eAAe,CAAC,IAAI,iBACT,QAAQ,eACP,IAAI,EACf,SAAS,EAAE,EAAE,CACX,scAAsc,EACtc,SAAS,CACV,KACG,KAAK,YAET,KAAC,eAAe,CAAC,KAAK,iBACV,cAAc,EACxB,SAAS,EAAE,EAAE,CACX,4OAA4O,EAC5O,yBAAyB,CAC1B,GACD,GACmB,CACxB,CAAA;AACH,CAAC;AAED,OAAO,EAAE,MAAM,EAAE,CAAA"}
1
+ {"version":3,"file":"switch.js","sourceRoot":"","sources":["../../src/ui/switch.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAA;AACpC,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAA;AAC7D,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,UAAU,CAAA;AAEpD,qHAAqH;AACrH,gGAAgG;AAChG,MAAM,gBAAgB,GACpB,+hBAA+hB,CAAA;AACjiB,wHAAwH;AACxH,MAAM,iBAAiB,GAAG,kGAAkG,CAAA;AAE5H,SAAS,MAAM,CAAC,EACd,SAAS,EACT,IAAI,GAAG,SAAS,EAChB,GAAG,KAAK,EAGT;IACC,OAAO,CACL,KAAC,eAAe,CAAC,IAAI,iBACT,QAAQ,eACP,IAAI,EACf,SAAS,EAAE,EAAE,CACX,scAAsc,EACtc,IAAI,KAAK,OAAO,IAAI,gBAAgB,EACpC,SAAS,CACV,KACG,KAAK,YAET,KAAC,eAAe,CAAC,KAAK,iBACV,cAAc,EACxB,SAAS,EAAE,EAAE,CACX,4OAA4O,EAC5O,yBAAyB,EACzB,IAAI,KAAK,OAAO,IAAI,iBAAiB,CACtC,GACD,GACmB,CACxB,CAAA;AACH,CAAC;AAED,OAAO,EAAE,MAAM,EAAE,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@softure-ai/theme-notion",
3
- "version": "0.29.1",
3
+ "version": "0.30.0",
4
4
  "description": "SOFTURE AI Notion theme: shadcn/ui components (new-york v4, Radix, Tailwind CSS v4, lucide) with the Notion design system's tokens and deltas, ready to import.",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/src/ui/switch.tsx CHANGED
@@ -5,12 +5,19 @@ import { cn } from "../lib/utils.js"
5
5
  import { SWITCH_THUMB_SHADOW_CLASS } from "./switch-thumb.js"
6
6
  import { Switch as SwitchPrimitive } from "radix-ui"
7
7
 
8
+ // The touch size: the root is the touch target (44 × 44) and draws the same 26 × 16 track inside it, so a phone taps
9
+ // the whole square; negative margins keep the switch's place in the layout at the track's size.
10
+ const TOUCH_ROOT_CLASS =
11
+ "relative -mx-[calc((var(--spacing-touch-target)-26px)/2)] -my-[calc((var(--spacing-touch-target)-16px)/2)] size-touch-target justify-center data-[state=checked]:bg-transparent data-[state=unchecked]:bg-transparent focus-visible:ring-0 before:absolute before:top-1/2 before:left-1/2 before:h-4 before:w-[26px] before:-translate-x-1/2 before:-translate-y-1/2 before:rounded-full before:transition-all data-[state=checked]:before:bg-primary data-[state=unchecked]:before:bg-control-off focus-visible:before:ring-2 focus-visible:before:ring-ring"
12
+ // The thumb sits centred in the square, so it moves 5 px either side of the centre: the track's 2 px inset at each end.
13
+ const TOUCH_THUMB_CLASS = "relative size-3 data-[state=checked]:translate-x-[5px] data-[state=unchecked]:-translate-x-[5px]"
14
+
8
15
  function Switch({
9
16
  className,
10
17
  size = "default",
11
18
  ...props
12
19
  }: React.ComponentProps<typeof SwitchPrimitive.Root> & {
13
- size?: "sm" | "default"
20
+ size?: "sm" | "default" | "touch"
14
21
  }) {
15
22
  return (
16
23
  <SwitchPrimitive.Root
@@ -18,6 +25,7 @@ function Switch({
18
25
  data-size={size}
19
26
  className={cn(
20
27
  "peer group/switch inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-4 data-[size=default]:w-[26px] data-[size=default]:p-0.5 data-[size=sm]:h-3.5 data-[size=sm]:w-[22px] data-[size=sm]:p-0.5 data-[state=checked]:bg-primary data-[state=unchecked]:bg-control-off",
28
+ size === "touch" && TOUCH_ROOT_CLASS,
21
29
  className
22
30
  )}
23
31
  {...props}
@@ -26,7 +34,8 @@ function Switch({
26
34
  data-slot="switch-thumb"
27
35
  className={cn(
28
36
  "pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-3 group-data-[size=sm]/switch:size-2.5 data-[state=checked]:translate-x-[10px] data-[state=unchecked]:translate-x-0",
29
- SWITCH_THUMB_SHADOW_CLASS
37
+ SWITCH_THUMB_SHADOW_CLASS,
38
+ size === "touch" && TOUCH_THUMB_CLASS
30
39
  )}
31
40
  />
32
41
  </SwitchPrimitive.Root>