@fluid-topics/ftds-checkbox 2.1.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.
@@ -0,0 +1,10 @@
1
+ export interface FtdsCheckboxProperties {
2
+ name: string;
3
+ value: string;
4
+ label: string;
5
+ checked: boolean;
6
+ indeterminate: boolean;
7
+ disabled: boolean;
8
+ legendColor: string;
9
+ helper: string;
10
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export declare const styles: import("lit").CSSResult;
@@ -0,0 +1,159 @@
1
+ import { checkbox } from "@fluid-topics/ft-wc-utils";
2
+ import { css } from "lit";
3
+ import { FtRippleCssVariables } from "@fluid-topics/ft-ripple";
4
+ import { FtdsIconCssVariables } from "@fluid-topics/ftds-icon";
5
+ // language=CSS
6
+ export const styles = css `
7
+ * {
8
+ box-sizing: border-box;
9
+ --input-size: calc(${checkbox.boxSize} + 2 * (${checkbox.focusOutlineOffset} + ${checkbox.focusOutlineWidth}));
10
+ --input-margin: calc(-1 * ${checkbox.focusOutlineOffset} - ${checkbox.focusOutlineWidth});
11
+ }
12
+
13
+ [part="checkbox-label-and-helper"] {
14
+ display: flex;
15
+ flex-direction: column;
16
+ align-items: self-start;
17
+ gap: ${checkbox.helperPaddingTop};
18
+ }
19
+
20
+ [part="checkbox-and-popover"] {
21
+ display: flex;
22
+ align-items: flex-start;
23
+ gap: ${checkbox.labelHorizontalGap};
24
+ }
25
+
26
+ [part="checkbox-popover"] {
27
+ flex: 0 0 auto;
28
+ height: ${checkbox.boxSize};
29
+
30
+ }
31
+
32
+ [part="checkbox-popover-wrapper"] {
33
+ margin-top: -5px;
34
+ }
35
+
36
+ [part="checkbox-helper"] {
37
+ display: block;
38
+ color: ${checkbox.helperTextColor};
39
+ margin-left: calc(${checkbox.boxSize} + ${checkbox.horizontalGap});
40
+
41
+ &.ftds-checkbox-helper--disabled {
42
+ background-color: transparent;
43
+ opacity: ${checkbox.uncheckedDisabledComponentOpacity};
44
+ }
45
+
46
+ &.ftds-checkbox-helper--disabled.ftds-checkbox-helper--checked, &.ftds-checkbox-helper--disabled.ftds-checkbox-helper--indeterminate {
47
+ background-color: transparent;
48
+ opacity: ${checkbox.checkedDisabledComponentOpacity};
49
+ }
50
+
51
+ &.ftds-checkbox-helper--legend-color-displayed {
52
+ margin-left: calc(${checkbox.boxSize} + (${checkbox.horizontalGap} * 2 + ${checkbox.colorLegendSize}));
53
+ }
54
+ }
55
+
56
+ .ftds-checkbox {
57
+ display: inline-flex;
58
+ align-items: flex-start;
59
+ gap: ${checkbox.horizontalGap};
60
+ color: ${checkbox.color};
61
+
62
+ input {
63
+ opacity: 0;
64
+ position: absolute;
65
+ flex: 0 0 auto;
66
+ width: var(--input-size);
67
+ height: var(--input-size);
68
+ border-radius: ${checkbox.borderRadius};
69
+ }
70
+
71
+ .ftds-checkbox--box-container {
72
+ position: relative;
73
+ display: flex;
74
+ flex: 0 0 auto;
75
+ justify-content: center;
76
+ align-items: center;
77
+ width: var(--input-size);
78
+ height: var(--input-size);
79
+ margin: var(--input-margin);
80
+ border-radius: ${checkbox.borderRadius};
81
+ }
82
+
83
+ .ftds-checkbox--box-container:has(:focus-visible) {
84
+ outline: ${checkbox.focusOutlineWidth} solid ${checkbox.focusFocusRingColor};
85
+ outline-offset: calc(${checkbox.focusOutlineWidth} * -1);
86
+ }
87
+
88
+ .ftds-checkbox--box {
89
+ display: flex;
90
+ flex: 0 0 auto;
91
+ align-items: center;
92
+ justify-content: center;
93
+ box-shadow: inset 0 0 0 ${checkbox.borderWidth} ${checkbox.uncheckedBorderColor};
94
+ border-radius: ${checkbox.borderRadius};
95
+ width: ${checkbox.boxSize};
96
+ height: ${checkbox.boxSize};
97
+ color: ${checkbox.checkedIconColor};
98
+
99
+ ftds-icon {
100
+ ${FtdsIconCssVariables.size.set(checkbox.iconSize)};
101
+ }
102
+ }
103
+
104
+ &.ftds-checkbox--disabled {
105
+ background-color: transparent;
106
+ opacity: ${checkbox.uncheckedDisabledComponentOpacity};
107
+ }
108
+
109
+ ft-ripple {
110
+ flex: 0 0 auto;
111
+ z-index: 0;
112
+ ${FtRippleCssVariables.color.set(checkbox.uncheckedStateLayerColor)};
113
+ ${FtRippleCssVariables.backgroundColor.set(checkbox.uncheckedStateLayerColor)};
114
+ ${FtRippleCssVariables.opacityContentOnSurfaceHover.set(checkbox.uncheckedHoverStateLayerOpacity)};
115
+ ${FtRippleCssVariables.opacityContentOnSurfaceFocused.set(checkbox.uncheckedFocusStateLayerOpacity)};
116
+ ${FtRippleCssVariables.opacityContentOnSurfacePressed.set(checkbox.uncheckedActiveStateLayerOpacity)};
117
+ ${FtRippleCssVariables.borderRadius.set(checkbox.focusOutlineBorderRadius)};
118
+ }
119
+
120
+ [part="checkbox-legend-color"] {
121
+ flex: 0 0 auto;
122
+ margin-top: calc((${checkbox.boxSize} - ${checkbox.colorLegendSize}) / 2);
123
+ width: ${checkbox.colorLegendSize};
124
+ height: ${checkbox.colorLegendSize};
125
+ border-radius: 50%;
126
+ }
127
+ }
128
+
129
+ .ftds-checkbox--checked, .ftds-checkbox--indeterminate {
130
+ color: ${checkbox.color};
131
+
132
+ .ftds-checkbox--box {
133
+ display: flex;
134
+ align-items: center;
135
+ justify-content: center;
136
+ background-color: ${checkbox.checkedBackgroundColor};
137
+ box-shadow: inset 0 0 0 ${checkbox.borderWidth} ${checkbox.checkedBackgroundColor};
138
+ color: ${checkbox.checkedIconColor};
139
+ }
140
+
141
+ &.ftds-checkbox--disabled {
142
+ opacity: ${checkbox.checkedDisabledComponentOpacity};
143
+ }
144
+
145
+ .ftds-checkbox--checkmark {
146
+ opacity: 1;
147
+ }
148
+
149
+ ft-ripple {
150
+ z-index: 0;
151
+ ${FtRippleCssVariables.color.set(checkbox.checkedStateLayerColor)};
152
+ ${FtRippleCssVariables.backgroundColor.set(checkbox.checkedStateLayerColor)};
153
+ ${FtRippleCssVariables.opacityContentOnSurfaceHover.set(checkbox.checkedHoverStateLayerOpacity)};
154
+ ${FtRippleCssVariables.opacityContentOnSurfaceFocused.set(checkbox.checkedFocusStateLayerOpacity)};
155
+ ${FtRippleCssVariables.opacityContentOnSurfacePressed.set(checkbox.checkedActiveStateLayerOpacity)};
156
+ ${FtRippleCssVariables.borderRadius.set(checkbox.focusOutlineBorderRadius)};
157
+ }
158
+ }
159
+ `;
@@ -0,0 +1,4 @@
1
+ export * from "./ftds-checkbox.styles";
2
+ export * from "./ftds-checkbox.properties";
3
+ export * from "./ftds-checkbox";
4
+ import "./define";
package/build/index.js ADDED
@@ -0,0 +1,4 @@
1
+ export * from "./ftds-checkbox.styles";
2
+ export * from "./ftds-checkbox.properties";
3
+ export * from "./ftds-checkbox";
4
+ import "./define";
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@fluid-topics/ftds-checkbox",
3
+ "version": "2.1.0",
4
+ "description": "The design system checkbox component",
5
+ "keywords": [
6
+ "Lit"
7
+ ],
8
+ "author": "Fluid Topics <devtopics@antidot.net>",
9
+ "license": "ISC",
10
+ "main": "build/index.js",
11
+ "web": "build/ftds-checkbox.min.js",
12
+ "typings": "build/index",
13
+ "files": [
14
+ "build/**/*.js",
15
+ "build/**/*.ts"
16
+ ],
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
20
+ },
21
+ "dependencies": {
22
+ "@fluid-topics/design-system-variables": "3.5.0",
23
+ "@fluid-topics/ft-ripple": "2.1.0",
24
+ "@fluid-topics/ft-wc-utils": "2.1.0",
25
+ "@fluid-topics/ftds-icon": "2.1.0",
26
+ "@fluid-topics/ftds-link": "2.1.0",
27
+ "@fluid-topics/ftds-popover": "2.1.0",
28
+ "@fluid-topics/ftds-typography": "2.1.0",
29
+ "lit": "3.1.0"
30
+ },
31
+ "devDependencies": {
32
+ "@fluid-topics/ft-wc-test-utils": "2.1.0"
33
+ },
34
+ "gitHead": "4727cf19d04236ad1d2b2cb43ce1c46298834c7e"
35
+ }