@tscircuit/props 0.0.477 → 0.0.478
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/dist/index.d.ts +8 -2
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/lib/components/potentiometer.ts +8 -2
- package/package.json +1 -1
|
@@ -1,22 +1,28 @@
|
|
|
1
1
|
import { resistance } from "circuit-json"
|
|
2
|
+
import { createConnectionsProp } from "lib/common/connectionsProp"
|
|
2
3
|
import {
|
|
3
4
|
type CommonComponentProps,
|
|
4
5
|
commonComponentProps,
|
|
5
|
-
lrPins,
|
|
6
6
|
} from "lib/common/layout"
|
|
7
7
|
import { expectTypesMatch } from "lib/typecheck"
|
|
8
|
+
import type { Connections } from "lib/utility-types/connections-and-selectors"
|
|
8
9
|
import { z } from "zod"
|
|
9
10
|
|
|
10
11
|
export type PotentiometerPinVariant = "two_pin" | "three_pin"
|
|
12
|
+
export const potentiometerPinLabels = ["pin1", "pin2", "pin3"] as const
|
|
13
|
+
export type PotentiometerPinLabels = (typeof potentiometerPinLabels)[number]
|
|
11
14
|
|
|
12
|
-
export interface PotentiometerProps extends
|
|
15
|
+
export interface PotentiometerProps<PinLabel extends string = string>
|
|
16
|
+
extends CommonComponentProps<PinLabel> {
|
|
13
17
|
maxResistance: number | string
|
|
14
18
|
pinVariant?: PotentiometerPinVariant
|
|
19
|
+
connections?: Connections<PotentiometerPinLabels>
|
|
15
20
|
}
|
|
16
21
|
|
|
17
22
|
export const potentiometerProps = commonComponentProps.extend({
|
|
18
23
|
maxResistance: resistance,
|
|
19
24
|
pinVariant: z.enum(["two_pin", "three_pin"]).optional(),
|
|
25
|
+
connections: createConnectionsProp(potentiometerPinLabels).optional(),
|
|
20
26
|
})
|
|
21
27
|
|
|
22
28
|
type InferredPotentiometerProps = z.input<typeof potentiometerProps>
|