@justeattakeaway/pie-switch 0.29.8 → 0.29.10

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
@@ -17,16 +17,14 @@
17
17
  To install `pie-switch` in your application, run the following on your command line:
18
18
 
19
19
  ```bash
20
- # npm
21
- $ npm i @justeattakeaway/pie-switch
20
+ npm i @justeattakeaway/pie-switch
22
21
 
23
- # yarn
24
- $ yarn add @justeattakeaway/pie-switch
22
+ yarn add @justeattakeaway/pie-switch
25
23
  ```
26
24
 
27
25
  ## Documentation
28
26
 
29
- Visit [Modal | PIE Design System](https://pie.design/components/modal/overview) to view more information on this component.
27
+ Visit [Switch | PIE Design System](https://pie.design/components/switch) to view more information on this component.
30
28
 
31
29
  ## Questions
32
30
 
@@ -35,7 +35,7 @@
35
35
  "type": {
36
36
  "text": "DefaultProps"
37
37
  },
38
- "default": "{\n labelPlacement: 'leading',\n checked: false,\n required: false,\n value: 'on',\n disabled: false,\n}"
38
+ "default": "{\n checked: false,\n required: false,\n disabled: false,\n value: 'on',\n labelPlacement: 'leading',\n}"
39
39
  }
40
40
  ],
41
41
  "exports": [
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ComponentDefaultPropsGeneric } from '@justeattakeaway/pie-webc-core';
1
+ import { ComponentDefaultProps } from '@justeattakeaway/pie-webc-core';
2
2
  import type { CSSResult } from 'lit';
3
3
  import type { FormControlInterface } from '@justeattakeaway/pie-webc-core';
4
4
  import type { GenericConstructor } from '@justeattakeaway/pie-webc-core';
@@ -13,7 +13,7 @@ export declare type AriaProps = {
13
13
  describedBy?: string;
14
14
  };
15
15
 
16
- export declare type DefaultProps = ComponentDefaultPropsGeneric<SwitchProps, 'labelPlacement' | 'checked' | 'required' | 'value' | 'disabled'>;
16
+ export declare type DefaultProps = ComponentDefaultProps<SwitchProps, keyof Omit<SwitchProps, 'aria' | 'label' | 'name'>>;
17
17
 
18
18
  export declare const defaultProps: DefaultProps;
19
19
 
package/dist/index.js CHANGED
@@ -4,11 +4,11 @@ import { FormControlMixin as Ie, RtlMixin as Se, wrapNativeEvent as Te, validPro
4
4
  import "@justeattakeaway/pie-icons-webc/dist/IconCheck.js";
5
5
  const Ne = `*,*:after,*:before{box-sizing:inherit}*,*:before,*:after{cursor:inherit}.c-switch-wrapper{display:inline-flex;align-items:center;gap:var(--dt-spacing-b);font-family:var(--dt-font-body-l-family);cursor:pointer}.c-switch-wrapper[disabled]{cursor:not-allowed}.c-switch{--switch-bg-color: var(--dt-color-interactive-form);--switch-bg-color--checked: var(--dt-color-interactive-brand);--switch-bg-color--disabled: var(--dt-color-disabled-01);--switch-width: 48px;--switch-height: 24px;--switch-control-size: 20px;--switch-padding: 2px;--switch-radius: var(--dt-radius-rounded-e);--switch-translation: calc(var(--switch-width) - var(--switch-control-size) - 2 * var(--switch-padding));position:relative;display:flex;width:var(--switch-width);height:var(--switch-height);flex-shrink:0;padding:var(--switch-padding);border-radius:var(--switch-radius);background-color:var(--switch-bg-color)}@media (prefers-reduced-motion: no-preference){.c-switch{transition:background-color .15s cubic-bezier(.4,0,.9,1) 0s}}.c-switch:hover{background-color:hsl(var(--dt-color-interactive-form-h),var(--dt-color-interactive-form-s),calc(var(--dt-color-interactive-form-l) - var(--dt-color-hover-01)))}.c-switch:focus,.c-switch:focus-within{box-shadow:0 0 0 2px var(--dt-color-focus-inner),0 0 0 4px var(--dt-color-focus-outer);outline:none}.c-switch:active{background-color:hsl(var(--dt-color-interactive-form-h),var(--dt-color-interactive-form-s),calc(var(--dt-color-interactive-form-l) - var(--dt-color-active-01)))}.c-switch[checked]{background-color:var(--switch-bg-color--checked)}@media (prefers-reduced-motion: no-preference){.c-switch[checked]{transition:background-color .15s cubic-bezier(.4,0,.9,1) 0s}}.c-switch[checked]:hover{background-color:hsl(var(--dt-color-interactive-brand-h),var(--dt-color-interactive-brand-s),calc(var(--dt-color-interactive-brand-l) - var(--dt-color-hover-01)))}.c-switch[checked]:focus,.c-switch[checked]:focus-within{background-color:var(--switch-bg-color--checked)}.c-switch[checked]:active{background-color:hsl(var(--dt-color-interactive-brand-h),var(--dt-color-interactive-brand-s),calc(var(--dt-color-interactive-brand-l) - var(--dt-color-active-01)))}[disabled] .c-switch{background-color:var(--switch-bg-color--disabled);pointer-events:none}.c-switch-input{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);border:0;left:50%;transform:translate(-50%) translateY(-50%);bottom:0}.c-switch-input:disabled{background-color:transparent}.c-switch-control{position:absolute;left:2px;width:var(--switch-control-size);height:var(--switch-control-size);border-radius:var(--switch-radius);background-color:var(--dt-color-interactive-light);padding:var(--switch-padding)}@media (prefers-reduced-motion: no-preference){.c-switch-control{transition:transform .15s cubic-bezier(.4,0,.9,1) 0s}}.c-switch-input:checked+.c-switch-control{transform:translate(var(--switch-translation))}@media (prefers-reduced-motion: no-preference){.c-switch-input:checked+.c-switch-control{transition:transform .15s cubic-bezier(.4,0,.9,1) 0s}}.c-switch-input:checked+.c-switch-control .c-pieIcon--check{color:var(--switch-bg-color--checked)}@media (prefers-reduced-motion: no-preference){.c-switch-input:checked+.c-switch-control .c-pieIcon--check{transition:color .15s cubic-bezier(.4,0,.9,1) 0s}}.c-switch-input:disabled~.c-switch-control{color:var(--switch-bg-color--disabled)}.c-switch-input:disabled~.c-switch-control .c-pieIcon--check{color:var(--switch-bg-color--disabled)}@media (prefers-reduced-motion: no-preference){.c-switch-input:disabled~.c-switch-control .c-pieIcon--check{transition:color .15s cubic-bezier(.4,0,.9,1) 0s}}.c-switch-description{position:absolute;display:block;height:1px;width:1px;overflow:hidden;padding:1px;white-space:nowrap}.c-switch-wrapper[isRTL] .c-switch-control{position:absolute;left:initial;right:2px}.c-switch-wrapper[isRTL] .c-switch-input:checked+.c-switch-control{transform:translate(calc(-1 * var(--switch-translation)))}@media (prefers-reduced-motion: no-preference){.c-switch-wrapper[isRTL] .c-switch-input:checked+.c-switch-control{transition:transform .15s cubic-bezier(.4,0,.9,1) 0s}}
6
6
  `, Pe = ["leading", "trailing"], ze = "change", x = {
7
- labelPlacement: "leading",
8
7
  checked: !1,
9
8
  required: !1,
9
+ disabled: !1,
10
10
  value: "on",
11
- disabled: !1
11
+ labelPlacement: "leading"
12
12
  };
13
13
  (function() {
14
14
  (function(g) {
package/dist/react.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ComponentDefaultPropsGeneric } from '@justeattakeaway/pie-webc-core';
1
+ import { ComponentDefaultProps } from '@justeattakeaway/pie-webc-core';
2
2
  import type { CSSResult } from 'lit';
3
3
  import type { FormControlInterface } from '@justeattakeaway/pie-webc-core';
4
4
  import type { GenericConstructor } from '@justeattakeaway/pie-webc-core';
@@ -14,7 +14,7 @@ export declare type AriaProps = {
14
14
  describedBy?: string;
15
15
  };
16
16
 
17
- export declare type DefaultProps = ComponentDefaultPropsGeneric<SwitchProps, 'labelPlacement' | 'checked' | 'required' | 'value' | 'disabled'>;
17
+ export declare type DefaultProps = ComponentDefaultProps<SwitchProps, keyof Omit<SwitchProps, 'aria' | 'label' | 'name'>>;
18
18
 
19
19
  export declare const defaultProps: DefaultProps;
20
20
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@justeattakeaway/pie-switch",
3
3
  "description": "PIE Design System Switch built using Web Components",
4
- "version": "0.29.8",
4
+ "version": "0.29.10",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -40,8 +40,8 @@
40
40
  "cem-plugin-module-file-extensions": "0.0.5"
41
41
  },
42
42
  "dependencies": {
43
- "@justeattakeaway/pie-icons-webc": "0.24.1",
44
- "@justeattakeaway/pie-webc-core": "0.23.0",
43
+ "@justeattakeaway/pie-icons-webc": "0.24.2",
44
+ "@justeattakeaway/pie-webc-core": "0.24.0",
45
45
  "@justeattakeaway/pie-wrapper-react": "0.14.1",
46
46
  "element-internals-polyfill": "1.3.11"
47
47
  },
package/src/defs.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { type ComponentDefaultPropsGeneric } from '@justeattakeaway/pie-webc-core';
1
+ import { type ComponentDefaultProps } from '@justeattakeaway/pie-webc-core';
2
2
 
3
3
  export const labelPlacements = ['leading', 'trailing'] as const;
4
4
 
@@ -51,11 +51,12 @@ export interface SwitchProps {
51
51
  */
52
52
  export const ON_SWITCH_CHANGED_EVENT = 'change';
53
53
 
54
- export type DefaultProps = ComponentDefaultPropsGeneric<SwitchProps, 'labelPlacement' | 'checked' | 'required' | 'value' | 'disabled'>;
54
+ export type DefaultProps = ComponentDefaultProps<SwitchProps, keyof Omit<SwitchProps, 'aria' | 'label' | 'name'>>;
55
+
55
56
  export const defaultProps: DefaultProps = {
56
- labelPlacement: 'leading',
57
57
  checked: false,
58
58
  required: false,
59
- value: 'on',
60
59
  disabled: false,
60
+ value: 'on',
61
+ labelPlacement: 'leading',
61
62
  };