@cambly/syntax-core 3.2.0 → 4.0.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/dist/index.css +6 -7
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +19 -31
- package/dist/index.js +17 -45
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -36
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -397,17 +397,6 @@ function foregroundColor(color) {
|
|
|
397
397
|
}
|
|
398
398
|
}
|
|
399
399
|
|
|
400
|
-
// src/Button/Button.tsx
|
|
401
|
-
var import_react2 = require("react");
|
|
402
|
-
|
|
403
|
-
// src/ButtonGroup/ButtonGroupContext.tsx
|
|
404
|
-
var import_react = __toESM(require("react"));
|
|
405
|
-
var ButtonGroupContext = import_react.default.createContext(
|
|
406
|
-
{}
|
|
407
|
-
);
|
|
408
|
-
ButtonGroupContext.displayName = "ButtonGroupContext";
|
|
409
|
-
var ButtonGroupContext_default = ButtonGroupContext;
|
|
410
|
-
|
|
411
400
|
// css-module:./Button.module.css#css-module
|
|
412
401
|
var Button_module_default = { "button": "_button_13egy_1", "buttonGap": "_buttonGap_13egy_9", "fullWidth": "_fullWidth_13egy_50", "sm": "_sm_13egy_54", "md": "_md_13egy_61", "lg": "_lg_13egy_68", "icon": "_icon_13egy_75", "smIcon": "_smIcon_13egy_79", "mdIcon": "_mdIcon_13egy_86", "lgIcon": "_lgIcon_13egy_93", "textContainer": "_textContainer_13egy_100", "secondaryBorder": "_secondaryBorder_13egy_105", "secondaryDestructiveBorder": "_secondaryDestructiveBorder_13egy_109", "loading": "_loading_13egy_123", "syntaxButtonLoadingRotate": "_syntaxButtonLoadingRotate_13egy_1", "loadingCircle": "_loadingCircle_13egy_127", "buttonText": "_buttonText_13egy_135", "buttonTextSmall": "_buttonTextSmall_13egy_142", "buttonTextMedium": "_buttonTextMedium_13egy_146", "buttonTextLarge": "_buttonTextLarge_13egy_150" };
|
|
413
402
|
|
|
@@ -433,20 +422,16 @@ var Button = ({
|
|
|
433
422
|
text,
|
|
434
423
|
loadingText,
|
|
435
424
|
color = "primary",
|
|
436
|
-
size
|
|
425
|
+
size = "md",
|
|
437
426
|
accessibilityLabel,
|
|
438
|
-
disabled
|
|
427
|
+
disabled = false,
|
|
439
428
|
loading = false,
|
|
440
|
-
fullWidth
|
|
429
|
+
fullWidth = false,
|
|
441
430
|
startIcon: StartIcon,
|
|
442
431
|
endIcon: EndIcon,
|
|
443
432
|
onClick,
|
|
444
433
|
tooltip
|
|
445
434
|
}) => {
|
|
446
|
-
const contextProps = (0, import_react2.useContext)(ButtonGroupContext_default);
|
|
447
|
-
const size = (contextProps == null ? void 0 : contextProps.size) || sizeProp;
|
|
448
|
-
const disabled = (contextProps == null ? void 0 : contextProps.disabled) || disabledProp;
|
|
449
|
-
const fullWidth = (contextProps == null ? void 0 : contextProps.fullWidth) || fullWidthProp;
|
|
450
435
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
451
436
|
"button",
|
|
452
437
|
{
|
|
@@ -497,11 +482,8 @@ var Button = ({
|
|
|
497
482
|
};
|
|
498
483
|
var Button_default = Button;
|
|
499
484
|
|
|
500
|
-
// src/ButtonGroup/ButtonGroup.tsx
|
|
501
|
-
var import_react3 = require("react");
|
|
502
|
-
|
|
503
485
|
// css-module:./ButtonGroup.module.css#css-module
|
|
504
|
-
var ButtonGroup_module_default = { "buttonGroup": "
|
|
486
|
+
var ButtonGroup_module_default = { "buttonGroup": "_buttonGroup_1f9x9_1", "horizontal": "_horizontal_1f9x9_5", "vertical": "_vertical_1f9x9_9", "smallGap": "_smallGap_1f9x9_13", "mediumGap": "_mediumGap_1f9x9_17", "largeGap": "_largeGap_1f9x9_21" };
|
|
505
487
|
|
|
506
488
|
// src/ButtonGroup/ButtonGroup.tsx
|
|
507
489
|
var import_classnames4 = __toESM(require_classnames());
|
|
@@ -512,21 +494,15 @@ var gap = {
|
|
|
512
494
|
["lg"]: ButtonGroup_module_default.largeGap
|
|
513
495
|
};
|
|
514
496
|
var ButtonGroup = ({
|
|
515
|
-
disabled = false,
|
|
516
|
-
fullWidth = false,
|
|
517
497
|
orientation = "horizontal",
|
|
518
498
|
size = "md",
|
|
519
499
|
children
|
|
520
500
|
}) => {
|
|
521
|
-
const context = (0, import_react3.useMemo)(
|
|
522
|
-
() => ({ disabled, fullWidth, size }),
|
|
523
|
-
[disabled, fullWidth, size]
|
|
524
|
-
);
|
|
525
501
|
const classnames2 = (0, import_classnames4.default)(ButtonGroup_module_default.buttonGroup, gap[size], {
|
|
526
502
|
[ButtonGroup_module_default.horizontal]: orientation === "horizontal",
|
|
527
503
|
[ButtonGroup_module_default.vertical]: orientation === "vertical"
|
|
528
504
|
});
|
|
529
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
505
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: classnames2, children });
|
|
530
506
|
};
|
|
531
507
|
var ButtonGroup_default = ButtonGroup;
|
|
532
508
|
|
|
@@ -545,7 +521,7 @@ var Divider_module_default = { "divider": "_divider_1ddgq_1" };
|
|
|
545
521
|
|
|
546
522
|
// src/Divider/Divider.tsx
|
|
547
523
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
548
|
-
function Divider(
|
|
524
|
+
function Divider() {
|
|
549
525
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("hr", { className: Divider_module_default.divider });
|
|
550
526
|
}
|
|
551
527
|
Divider.displayName = "Divider";
|
|
@@ -623,7 +599,6 @@ var Heading_default = Heading;
|
|
|
623
599
|
|
|
624
600
|
// src/IconButton/IconButton.tsx
|
|
625
601
|
var import_classnames6 = __toESM(require_classnames());
|
|
626
|
-
var import_react4 = require("react");
|
|
627
602
|
|
|
628
603
|
// css-module:./IconButton.module.css#css-module
|
|
629
604
|
var IconButton_module_default = { "iconButton": "_iconButton_dzhn0_1", "sm": "_sm_dzhn0_46", "md": "_md_dzhn0_51", "lg": "_lg_dzhn0_56", "smIcon": "_smIcon_dzhn0_61", "mdIcon": "_mdIcon_dzhn0_68", "lgIcon": "_lgIcon_dzhn0_75" };
|
|
@@ -638,15 +613,12 @@ var iconSize2 = {
|
|
|
638
613
|
var IconButton = ({
|
|
639
614
|
accessibilityLabel,
|
|
640
615
|
color = "primary",
|
|
641
|
-
disabled
|
|
616
|
+
disabled = false,
|
|
642
617
|
icon: Icon,
|
|
643
|
-
size
|
|
618
|
+
size = "md",
|
|
644
619
|
tooltip,
|
|
645
620
|
onClick
|
|
646
621
|
}) => {
|
|
647
|
-
const contextProps = (0, import_react4.useContext)(ButtonGroupContext_default);
|
|
648
|
-
const size = (contextProps == null ? void 0 : contextProps.size) || sizeProp;
|
|
649
|
-
const disabled = (contextProps == null ? void 0 : contextProps.disabled) || disabledProp;
|
|
650
622
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
651
623
|
"button",
|
|
652
624
|
{
|
|
@@ -668,7 +640,7 @@ var IconButton = ({
|
|
|
668
640
|
var IconButton_default = IconButton;
|
|
669
641
|
|
|
670
642
|
// src/Checkbox/Checkbox.tsx
|
|
671
|
-
var
|
|
643
|
+
var import_react = require("react");
|
|
672
644
|
var import_classnames7 = __toESM(require_classnames());
|
|
673
645
|
|
|
674
646
|
// css-module:./Checkbox.module.css#css-module
|
|
@@ -692,7 +664,7 @@ var Checkbox = ({
|
|
|
692
664
|
error = false,
|
|
693
665
|
onChange
|
|
694
666
|
}) => {
|
|
695
|
-
const [isFocused, setIsFocused] = (0,
|
|
667
|
+
const [isFocused, setIsFocused] = (0, import_react.useState)(false);
|
|
696
668
|
const checkboxStyling = (0, import_classnames7.default)(Checkbox_module_default.checkbox, Checkbox_module_default[size]);
|
|
697
669
|
const uncheckedStyling = (0, import_classnames7.default)(checkboxStyling, Checkbox_module_default.uncheckedBox, {
|
|
698
670
|
[Checkbox_module_default.uncheckedBorder]: !error,
|
|
@@ -753,14 +725,14 @@ var MiniActionCard = ({
|
|
|
753
725
|
var MiniActionCard_default = MiniActionCard;
|
|
754
726
|
|
|
755
727
|
// src/RadioButton/RadioButton.tsx
|
|
756
|
-
var
|
|
728
|
+
var import_react3 = require("react");
|
|
757
729
|
var import_classnames8 = __toESM(require_classnames());
|
|
758
730
|
|
|
759
731
|
// css-module:./RadioButton.module.css#css-module
|
|
760
732
|
var RadioButton_module_default = { "radioBaseContainer": "_radioBaseContainer_x6och_1", "smBase": "_smBase_x6och_8", "mdBase": "_mdBase_x6och_13", "radioStyleOverride": "_radioStyleOverride_x6och_18", "smOverride": "_smOverride_x6och_23", "mdOverride": "_mdOverride_x6och_28", "background": "_background_x6och_33", "sm": "_sm_x6och_8", "md": "_md_x6och_13", "neutralBorder": "_neutralBorder_x6och_50", "smCheckedBorder": "_smCheckedBorder_x6och_54", "mdCheckedBorder": "_mdCheckedBorder_x6och_58", "errorBorderColor": "_errorBorderColor_x6och_62", "borderColor": "_borderColor_x6och_66", "focusedRadioButton": "_focusedRadioButton_x6och_70" };
|
|
761
733
|
|
|
762
734
|
// src/useFocusVisible.tsx
|
|
763
|
-
var
|
|
735
|
+
var import_react2 = require("react");
|
|
764
736
|
var hasSetupGlobalListeners = false;
|
|
765
737
|
var currentModality = null;
|
|
766
738
|
var changeHandlers = /* @__PURE__ */ new Set();
|
|
@@ -830,8 +802,8 @@ function setupGlobalFocusEvents() {
|
|
|
830
802
|
}
|
|
831
803
|
function useFocusVisible() {
|
|
832
804
|
setupGlobalFocusEvents();
|
|
833
|
-
const [isFocusVisibleState, setFocusVisible] = (0,
|
|
834
|
-
(0,
|
|
805
|
+
const [isFocusVisibleState, setFocusVisible] = (0, import_react2.useState)(isFocusVisible());
|
|
806
|
+
(0, import_react2.useEffect)(() => {
|
|
835
807
|
const handler = () => {
|
|
836
808
|
setFocusVisible(isFocusVisible());
|
|
837
809
|
};
|
|
@@ -855,7 +827,7 @@ var RadioButton = ({
|
|
|
855
827
|
size = "md",
|
|
856
828
|
value
|
|
857
829
|
}) => {
|
|
858
|
-
const [isFocused, setIsFocused] = (0,
|
|
830
|
+
const [isFocused, setIsFocused] = (0, import_react3.useState)(false);
|
|
859
831
|
const { isFocusVisible: isFocusVisible2 } = useFocusVisible();
|
|
860
832
|
const sharedStyles = (0, import_classnames8.default)(RadioButton_module_default.background, RadioButton_module_default[size], {
|
|
861
833
|
[RadioButton_module_default.errorBorderColor]: error,
|
|
@@ -915,7 +887,7 @@ var RadioButton = ({
|
|
|
915
887
|
var RadioButton_default = RadioButton;
|
|
916
888
|
|
|
917
889
|
// src/SelectList/SelectList.tsx
|
|
918
|
-
var
|
|
890
|
+
var import_react4 = require("react");
|
|
919
891
|
var import_classnames9 = __toESM(require_classnames());
|
|
920
892
|
|
|
921
893
|
// ../syntax-design-tokens/dist/js/index.js
|
|
@@ -960,7 +932,7 @@ var SelectList = ({
|
|
|
960
932
|
selectedValue = "",
|
|
961
933
|
size = "md"
|
|
962
934
|
}) => {
|
|
963
|
-
const id = (0,
|
|
935
|
+
const id = (0, import_react4.useId)();
|
|
964
936
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
965
937
|
"div",
|
|
966
938
|
{
|