@indico-data/design-system 2.7.0 → 2.8.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/lib/index.css CHANGED
@@ -1083,21 +1083,21 @@
1083
1083
  .form-control .checkbox-input-label {
1084
1084
  cursor: pointer;
1085
1085
  }
1086
- .form-control [type=checkbox]:checked,
1087
- .form-control [type=checkbox]:not(:checked) {
1086
+ .form-control .checkbox-input:checked,
1087
+ .form-control .checkbox-input:not(:checked) {
1088
1088
  position: absolute;
1089
1089
  left: -9999px;
1090
1090
  }
1091
- .form-control [type=checkbox]:checked + label,
1092
- .form-control [type=checkbox]:not(:checked) + label {
1091
+ .form-control .checkbox-input:checked + label,
1092
+ .form-control .checkbox-input:not(:checked) + label {
1093
1093
  position: relative;
1094
1094
  padding-left: var(--pf-padding-7);
1095
1095
  cursor: pointer;
1096
1096
  line-height: 20px;
1097
1097
  display: inline-block;
1098
1098
  }
1099
- .form-control [type=checkbox]:checked + label:before,
1100
- .form-control [type=checkbox]:not(:checked) + label:before {
1099
+ .form-control .checkbox-input:checked + label:before,
1100
+ .form-control .checkbox-input:not(:checked) + label:before {
1101
1101
  content: "";
1102
1102
  position: absolute;
1103
1103
  left: 0;
@@ -1108,8 +1108,8 @@
1108
1108
  border-radius: var(--pf-rounded);
1109
1109
  background: var(--pf-checkbox-background-color);
1110
1110
  }
1111
- .form-control [type=checkbox]:checked + label:after,
1112
- .form-control [type=checkbox]:not(:checked) + label:after {
1111
+ .form-control .checkbox-input:checked + label:after,
1112
+ .form-control .checkbox-input:not(:checked) + label:after {
1113
1113
  content: "";
1114
1114
  width: 12px;
1115
1115
  height: 12px;
@@ -1120,29 +1120,105 @@
1120
1120
  border-radius: var(--pf-rounded);
1121
1121
  transition: all 0.2s ease;
1122
1122
  }
1123
- .form-control [type=checkbox]:not(:checked) + label:after {
1123
+ .form-control .checkbox-input:not(:checked) + label:after {
1124
1124
  opacity: 0;
1125
1125
  transform: scale(0);
1126
1126
  }
1127
- .form-control [type=checkbox]:checked + label:after {
1127
+ .form-control .checkbox-input:checked + label:after {
1128
1128
  opacity: 1;
1129
1129
  transform: scale(1);
1130
1130
  }
1131
- .form-control [type=checkbox]:disabled,
1132
- .form-control [type=checkbox]:disabled + label {
1131
+ .form-control .checkbox-input:disabled,
1132
+ .form-control .checkbox-input:disabled + label {
1133
1133
  cursor: not-allowed;
1134
1134
  }
1135
- .form-control [type=checkbox]:disabled + label {
1135
+ .form-control .checkbox-input:disabled + label {
1136
1136
  color: var(--pf-checkbox-disabled-color);
1137
1137
  opacity: 0.5;
1138
1138
  }
1139
- .form-control [type=checkbox]:disabled + label:before {
1139
+ .form-control .checkbox-input:disabled + label:before {
1140
1140
  border-color: var(--pf-checkbox-disabled-color);
1141
1141
  }
1142
- .form-control [type=checkbox]:disabled + label:after {
1142
+ .form-control .checkbox-input:disabled + label:after {
1143
1143
  background: var(--pf-checkbox-disabled-color);
1144
1144
  }
1145
1145
 
1146
+ :root,
1147
+ :root [data-theme=light],
1148
+ :root [data-theme=dark] {
1149
+ --pf-toggle-background-color: var(--pf-gray-color-200);
1150
+ --pf-toggle-circle-color: var(--pf-primary-color);
1151
+ --pf-toggle-border-color: var(--pf-gray-color);
1152
+ --pf-toggle-disabled-background-color: var(--pf-gray-color-400);
1153
+ --pf-toggle-disabled-circle-color: var(--pf-gray-color-300);
1154
+ --pf-toggle-checked-background-color: var(--pf-primary-color-200);
1155
+ }
1156
+
1157
+ :root [data-theme=dark] {
1158
+ --pf-toggle-background-color: var(--pf-primary-color-100);
1159
+ --pf-toggle-circle-color: var(--pf-white-color);
1160
+ --pf-toggle-border-color: var(--pf-white-color);
1161
+ --pf-toggle-disabled-background-color: var(--pf-gray-color-600);
1162
+ --pf-toggle-disabled-circle-color: var(--pf-gray-color-900);
1163
+ --pf-toggle-checked-background-color: var(--pf-secondary-color-400);
1164
+ }
1165
+
1166
+ .switch {
1167
+ position: relative;
1168
+ display: inline-block;
1169
+ width: 40px;
1170
+ height: 20px;
1171
+ background-color: var(--pf-toggle-background-color);
1172
+ border-radius: 20px;
1173
+ transition: all 0.3s;
1174
+ cursor: pointer;
1175
+ }
1176
+
1177
+ .switch::after {
1178
+ content: "";
1179
+ position: absolute;
1180
+ width: 18px;
1181
+ height: 18px;
1182
+ border-radius: 50%;
1183
+ background-color: var(--pf-toggle-circle-color);
1184
+ top: 1px;
1185
+ left: 1px;
1186
+ transition: all 0.3s;
1187
+ }
1188
+
1189
+ .toggle-input:checked + label.switch::after {
1190
+ left: 20px;
1191
+ }
1192
+
1193
+ .toggle-input:checked + label.switch {
1194
+ background-color: var(--pf-toggle-checked-background-color);
1195
+ }
1196
+
1197
+ .toggle-input:checked,
1198
+ .toggle-input:not(:checked) {
1199
+ position: absolute;
1200
+ left: -9999px;
1201
+ }
1202
+
1203
+ .toggle-input:disabled + label.switch {
1204
+ background-color: var(--pf-toggle-disabled-background-color);
1205
+ cursor: not-allowed;
1206
+ }
1207
+
1208
+ .toggle-input:disabled + label.switch::after {
1209
+ background-color: var(--pf-toggle-disabled-circle-color);
1210
+ }
1211
+
1212
+ .toggle-wrapper {
1213
+ display: flex;
1214
+ align-items: center;
1215
+ }
1216
+
1217
+ .toggle-label {
1218
+ cursor: pointer;
1219
+ margin-left: var(--pf-margin-2);
1220
+ }
1221
+
1146
1222
  :root {
1147
1223
  --pf-font-family-base: "Mulish", sans-serif;
1148
1224
  --pf-font-size-base: 1rem;
package/lib/index.d.ts CHANGED
@@ -758,7 +758,7 @@ type Props$1 = {
758
758
  checkedIconName?: IconName$1;
759
759
  notCheckedIconName?: IconName$1;
760
760
  } & PermafrostComponent$1;
761
- declare const Toggle: (props: Props$1) => react_jsx_runtime.JSX.Element;
761
+ declare const Toggle$1: (props: Props$1) => react_jsx_runtime.JSX.Element;
762
762
 
763
763
  type Props = PermafrostComponent$1 & {
764
764
  questionMark?: boolean;
@@ -962,4 +962,16 @@ interface CheckboxProps {
962
962
  }
963
963
  declare const Checkbox: ({ ref, id, label, name, value, onChange, isDisabled, isChecked, ...rest }: CheckboxProps) => react_jsx_runtime.JSX.Element;
964
964
 
965
- export { animation as ANIMATION, Radio$1 as AbstractRadio, RadioGroup as AbstractRadioGroup, Accordion, breakpoints as BREAKPOINT, BarSpinner, BorderSelect, Button, allColors as COLORS, Checkbox, CirclePulse, CircleSpinner, Col, ConfirmModal, Container, DatePicker, EditableInput, GlobalStyles, Icon, IconButton, Input, Button$1 as LegacyButton, ListTable, LoadingAwareContainer, LoadingList, margin as MARGINS, MATH, mediaQueries as MEDIA_QUERIES, ModalBase, MultiCombobox, NoInputDatePicker, NumberInput, padding as PADDINGS, Pagination, PercentageRing, Radio$2 as Radio, RadioGroup$1 as RadioGroup, Radio as RadioInput, RandomLoadingMessage, Row, spacings as SPACING, SearchInput, Section, SectionBlock, SectionBody, SectionHeader, SectionTable, Select, Shrug, SingleCombobox, typography as TYPOGRAPHY, Table, TextInput, TextTruncate, Toggle, Tooltip, color as colorUtils, number as numberUtils, string as stringUtils };
965
+ interface ToggleProps {
966
+ ref?: React$1.LegacyRef<HTMLInputElement>;
967
+ id: string;
968
+ label?: string;
969
+ name: string;
970
+ value?: string;
971
+ onChange: (e: React$1.ChangeEvent<HTMLInputElement>) => void;
972
+ isDisabled?: boolean;
973
+ isChecked?: boolean;
974
+ }
975
+ declare const Toggle: ({ ref, id, label, name, value, onChange, isDisabled, isChecked, ...rest }: ToggleProps) => react_jsx_runtime.JSX.Element;
976
+
977
+ export { animation as ANIMATION, Radio$1 as AbstractRadio, RadioGroup as AbstractRadioGroup, Accordion, breakpoints as BREAKPOINT, BarSpinner, BorderSelect, Button, allColors as COLORS, Checkbox, CirclePulse, CircleSpinner, Col, ConfirmModal, Container, DatePicker, EditableInput, GlobalStyles, Icon, IconButton, Input, Button$1 as LegacyButton, ListTable, LoadingAwareContainer, LoadingList, margin as MARGINS, MATH, mediaQueries as MEDIA_QUERIES, ModalBase, MultiCombobox, NoInputDatePicker, NumberInput, padding as PADDINGS, Pagination, PercentageRing, Radio$2 as Radio, RadioGroup$1 as RadioGroup, Radio as RadioInput, RandomLoadingMessage, Row, spacings as SPACING, SearchInput, Section, SectionBlock, SectionBody, SectionHeader, SectionTable, Select, Shrug, SingleCombobox, typography as TYPOGRAPHY, Table, TextInput, TextTruncate, Toggle$1 as Toggle, Toggle as ToggleInput, Tooltip, color as colorUtils, number as numberUtils, string as stringUtils };
package/lib/index.esm.css CHANGED
@@ -1083,21 +1083,21 @@
1083
1083
  .form-control .checkbox-input-label {
1084
1084
  cursor: pointer;
1085
1085
  }
1086
- .form-control [type=checkbox]:checked,
1087
- .form-control [type=checkbox]:not(:checked) {
1086
+ .form-control .checkbox-input:checked,
1087
+ .form-control .checkbox-input:not(:checked) {
1088
1088
  position: absolute;
1089
1089
  left: -9999px;
1090
1090
  }
1091
- .form-control [type=checkbox]:checked + label,
1092
- .form-control [type=checkbox]:not(:checked) + label {
1091
+ .form-control .checkbox-input:checked + label,
1092
+ .form-control .checkbox-input:not(:checked) + label {
1093
1093
  position: relative;
1094
1094
  padding-left: var(--pf-padding-7);
1095
1095
  cursor: pointer;
1096
1096
  line-height: 20px;
1097
1097
  display: inline-block;
1098
1098
  }
1099
- .form-control [type=checkbox]:checked + label:before,
1100
- .form-control [type=checkbox]:not(:checked) + label:before {
1099
+ .form-control .checkbox-input:checked + label:before,
1100
+ .form-control .checkbox-input:not(:checked) + label:before {
1101
1101
  content: "";
1102
1102
  position: absolute;
1103
1103
  left: 0;
@@ -1108,8 +1108,8 @@
1108
1108
  border-radius: var(--pf-rounded);
1109
1109
  background: var(--pf-checkbox-background-color);
1110
1110
  }
1111
- .form-control [type=checkbox]:checked + label:after,
1112
- .form-control [type=checkbox]:not(:checked) + label:after {
1111
+ .form-control .checkbox-input:checked + label:after,
1112
+ .form-control .checkbox-input:not(:checked) + label:after {
1113
1113
  content: "";
1114
1114
  width: 12px;
1115
1115
  height: 12px;
@@ -1120,29 +1120,105 @@
1120
1120
  border-radius: var(--pf-rounded);
1121
1121
  transition: all 0.2s ease;
1122
1122
  }
1123
- .form-control [type=checkbox]:not(:checked) + label:after {
1123
+ .form-control .checkbox-input:not(:checked) + label:after {
1124
1124
  opacity: 0;
1125
1125
  transform: scale(0);
1126
1126
  }
1127
- .form-control [type=checkbox]:checked + label:after {
1127
+ .form-control .checkbox-input:checked + label:after {
1128
1128
  opacity: 1;
1129
1129
  transform: scale(1);
1130
1130
  }
1131
- .form-control [type=checkbox]:disabled,
1132
- .form-control [type=checkbox]:disabled + label {
1131
+ .form-control .checkbox-input:disabled,
1132
+ .form-control .checkbox-input:disabled + label {
1133
1133
  cursor: not-allowed;
1134
1134
  }
1135
- .form-control [type=checkbox]:disabled + label {
1135
+ .form-control .checkbox-input:disabled + label {
1136
1136
  color: var(--pf-checkbox-disabled-color);
1137
1137
  opacity: 0.5;
1138
1138
  }
1139
- .form-control [type=checkbox]:disabled + label:before {
1139
+ .form-control .checkbox-input:disabled + label:before {
1140
1140
  border-color: var(--pf-checkbox-disabled-color);
1141
1141
  }
1142
- .form-control [type=checkbox]:disabled + label:after {
1142
+ .form-control .checkbox-input:disabled + label:after {
1143
1143
  background: var(--pf-checkbox-disabled-color);
1144
1144
  }
1145
1145
 
1146
+ :root,
1147
+ :root [data-theme=light],
1148
+ :root [data-theme=dark] {
1149
+ --pf-toggle-background-color: var(--pf-gray-color-200);
1150
+ --pf-toggle-circle-color: var(--pf-primary-color);
1151
+ --pf-toggle-border-color: var(--pf-gray-color);
1152
+ --pf-toggle-disabled-background-color: var(--pf-gray-color-400);
1153
+ --pf-toggle-disabled-circle-color: var(--pf-gray-color-300);
1154
+ --pf-toggle-checked-background-color: var(--pf-primary-color-200);
1155
+ }
1156
+
1157
+ :root [data-theme=dark] {
1158
+ --pf-toggle-background-color: var(--pf-primary-color-100);
1159
+ --pf-toggle-circle-color: var(--pf-white-color);
1160
+ --pf-toggle-border-color: var(--pf-white-color);
1161
+ --pf-toggle-disabled-background-color: var(--pf-gray-color-600);
1162
+ --pf-toggle-disabled-circle-color: var(--pf-gray-color-900);
1163
+ --pf-toggle-checked-background-color: var(--pf-secondary-color-400);
1164
+ }
1165
+
1166
+ .switch {
1167
+ position: relative;
1168
+ display: inline-block;
1169
+ width: 40px;
1170
+ height: 20px;
1171
+ background-color: var(--pf-toggle-background-color);
1172
+ border-radius: 20px;
1173
+ transition: all 0.3s;
1174
+ cursor: pointer;
1175
+ }
1176
+
1177
+ .switch::after {
1178
+ content: "";
1179
+ position: absolute;
1180
+ width: 18px;
1181
+ height: 18px;
1182
+ border-radius: 50%;
1183
+ background-color: var(--pf-toggle-circle-color);
1184
+ top: 1px;
1185
+ left: 1px;
1186
+ transition: all 0.3s;
1187
+ }
1188
+
1189
+ .toggle-input:checked + label.switch::after {
1190
+ left: 20px;
1191
+ }
1192
+
1193
+ .toggle-input:checked + label.switch {
1194
+ background-color: var(--pf-toggle-checked-background-color);
1195
+ }
1196
+
1197
+ .toggle-input:checked,
1198
+ .toggle-input:not(:checked) {
1199
+ position: absolute;
1200
+ left: -9999px;
1201
+ }
1202
+
1203
+ .toggle-input:disabled + label.switch {
1204
+ background-color: var(--pf-toggle-disabled-background-color);
1205
+ cursor: not-allowed;
1206
+ }
1207
+
1208
+ .toggle-input:disabled + label.switch::after {
1209
+ background-color: var(--pf-toggle-disabled-circle-color);
1210
+ }
1211
+
1212
+ .toggle-wrapper {
1213
+ display: flex;
1214
+ align-items: center;
1215
+ }
1216
+
1217
+ .toggle-label {
1218
+ cursor: pointer;
1219
+ margin-left: var(--pf-margin-2);
1220
+ }
1221
+
1146
1222
  :root {
1147
1223
  --pf-font-family-base: "Mulish", sans-serif;
1148
1224
  --pf-font-size-base: 1rem;
package/lib/index.esm.js CHANGED
@@ -18656,7 +18656,12 @@ const Radio$2 = (_a) => {
18656
18656
 
18657
18657
  const Checkbox = (_a) => {
18658
18658
  var { ref, id, label, name, value, onChange, isDisabled, isChecked = false } = _a, rest = __rest$1(_a, ["ref", "id", "label", "name", "value", "onChange", "isDisabled", "isChecked"]);
18659
- return (jsx("div", { className: "form-control", children: jsxs("div", { className: "checkbox-wrapper", children: [jsx("input", Object.assign({ "data-testid": `form-checkbox-input-${name}` }, rest, { className: "checkbox-input", type: "checkbox", id: id, checked: isChecked, name: name, value: value, disabled: isDisabled, ref: ref, onChange: onChange, tabIndex: 0, "aria-describedby": id, "aria-label": label })), jsx("label", { htmlFor: id, className: "checkbox-input-label", "data-testid": `label-checkbox-input-${name}`, children: label })] }) }));
18659
+ return (jsx("div", { className: "form-control", children: jsxs("div", { className: "checkbox-wrapper", children: [jsx("input", Object.assign({ "data-testid": `form-checkbox-input-${name}`, className: "checkbox-input", type: "checkbox", id: id, checked: isChecked, name: name, value: value, disabled: isDisabled, ref: ref, onChange: onChange, tabIndex: 0, "aria-describedby": id, "aria-label": label }, rest)), jsx("label", { htmlFor: id, className: "checkbox-input-label", "data-testid": `label-checkbox-input-${name}`, children: label })] }) }));
18660
+ };
18661
+
18662
+ const Toggle$1 = (_a) => {
18663
+ var { ref, id, label, name, value, onChange, isDisabled, isChecked } = _a, rest = __rest$1(_a, ["ref", "id", "label", "name", "value", "onChange", "isDisabled", "isChecked"]);
18664
+ return (jsx("div", { className: "form-control", children: jsxs("div", { className: "toggle-wrapper", children: [jsx("input", Object.assign({ "data-testid": `form-toggle-input-${name}`, className: "toggle-input", type: "checkbox", id: id, checked: isChecked, name: name, value: value, disabled: isDisabled, ref: ref, onChange: onChange, tabIndex: 0, "aria-describedby": id, "aria-label": label }, rest)), jsx("label", { htmlFor: id, className: "switch" }), jsx("label", { className: 'toggle-label', htmlFor: id, children: label })] }) }));
18660
18665
  };
18661
18666
 
18662
18667
  const StyledAccordion = styled.details `
@@ -41480,5 +41485,5 @@ const Tooltip = (props) => {
41480
41485
  openOnClick: props.clickToShow, id: props.for, delayShow: props.delayShow, delayHide: props.delayHide, children: props.children })] }));
41481
41486
  };
41482
41487
 
41483
- export { animation as ANIMATION, Radio$1 as AbstractRadio, RadioGroup$1 as AbstractRadioGroup, Accordion, breakpoints as BREAKPOINT, BarSpinner, BorderSelect, Button$2 as Button, allColors as COLORS, Checkbox, CirclePulse, CircleSpinner, Col, ConfirmModal, Container, DatePicker, EditableInput, GlobalStyles, Icon, IconButton, Input, Button$1 as LegacyButton, ListTable, LoadingAwareContainer, LoadingList, margin as MARGINS, MATH, mediaQueries as MEDIA_QUERIES, ModalBase, MultiCombobox, NoInputDatePicker, NumberInput, padding as PADDINGS, Pagination, PercentageRing, Radio, RadioGroup, Radio$2 as RadioInput, RandomLoadingMessage, Row$1 as Row, spacings as SPACING, SearchInput, Section, SectionBlock, SectionBody, SectionHeader, SectionTable, Select, Shrug, SingleCombobox, typography as TYPOGRAPHY, Table$1 as Table, TextInput, TextTruncate, Toggle, Tooltip, color as colorUtils, number as numberUtils, string as stringUtils };
41488
+ export { animation as ANIMATION, Radio$1 as AbstractRadio, RadioGroup$1 as AbstractRadioGroup, Accordion, breakpoints as BREAKPOINT, BarSpinner, BorderSelect, Button$2 as Button, allColors as COLORS, Checkbox, CirclePulse, CircleSpinner, Col, ConfirmModal, Container, DatePicker, EditableInput, GlobalStyles, Icon, IconButton, Input, Button$1 as LegacyButton, ListTable, LoadingAwareContainer, LoadingList, margin as MARGINS, MATH, mediaQueries as MEDIA_QUERIES, ModalBase, MultiCombobox, NoInputDatePicker, NumberInput, padding as PADDINGS, Pagination, PercentageRing, Radio, RadioGroup, Radio$2 as RadioInput, RandomLoadingMessage, Row$1 as Row, spacings as SPACING, SearchInput, Section, SectionBlock, SectionBody, SectionHeader, SectionTable, Select, Shrug, SingleCombobox, typography as TYPOGRAPHY, Table$1 as Table, TextInput, TextTruncate, Toggle, Toggle$1 as ToggleInput, Tooltip, color as colorUtils, number as numberUtils, string as stringUtils };
41484
41489
  //# sourceMappingURL=index.esm.js.map