@uniformdev/design-system 19.147.1-alpha.3 → 19.149.1-alpha.1
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/esm/index.js +148 -55
- package/dist/index.d.mts +7 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.js +145 -52
- package/package.json +4 -4
package/dist/esm/index.js
CHANGED
|
@@ -11923,6 +11923,7 @@ var TooltipContainer = css24`
|
|
|
11923
11923
|
color: var(--gray-500);
|
|
11924
11924
|
font-size: var(--fs-xs);
|
|
11925
11925
|
background: var(--white);
|
|
11926
|
+
position: relative;
|
|
11926
11927
|
`;
|
|
11927
11928
|
var TooltipArrowStyles = css24`
|
|
11928
11929
|
svg {
|
|
@@ -20546,10 +20547,60 @@ var ProgressListItem = ({
|
|
|
20546
20547
|
// src/components/SegmentedControl/SegmentedControl.tsx
|
|
20547
20548
|
import { css as css93 } from "@emotion/react";
|
|
20548
20549
|
import { CgCheck as CgCheck4 } from "@react-icons/all-files/cg/CgCheck";
|
|
20549
|
-
import { useCallback as useCallback10, useMemo as useMemo6 } from "react";
|
|
20550
|
+
import { useCallback as useCallback10, useEffect as useEffect17, useMemo as useMemo6, useRef as useRef9, useState as useState16 } from "react";
|
|
20550
20551
|
|
|
20551
20552
|
// src/components/SegmentedControl/SegmentedControl.styles.ts
|
|
20552
20553
|
import { css as css92 } from "@emotion/react";
|
|
20554
|
+
var segmentedControlRootStyles = css92`
|
|
20555
|
+
position: relative;
|
|
20556
|
+
`;
|
|
20557
|
+
var segmentedControlScrollIndicatorsStyles = css92`
|
|
20558
|
+
position: absolute;
|
|
20559
|
+
inset: 0;
|
|
20560
|
+
z-index: 1;
|
|
20561
|
+
pointer-events: none;
|
|
20562
|
+
|
|
20563
|
+
&::before,
|
|
20564
|
+
&::after {
|
|
20565
|
+
content: '';
|
|
20566
|
+
display: block;
|
|
20567
|
+
position: absolute;
|
|
20568
|
+
top: 0;
|
|
20569
|
+
bottom: 0;
|
|
20570
|
+
left: 0;
|
|
20571
|
+
width: var(--spacing-sm);
|
|
20572
|
+
background: linear-gradient(to right, var(--background-color) 10%, transparent);
|
|
20573
|
+
opacity: 0;
|
|
20574
|
+
transform-origin: left;
|
|
20575
|
+
transition: opacity var(--duration-xfast) ease-in-out;
|
|
20576
|
+
}
|
|
20577
|
+
|
|
20578
|
+
&::after {
|
|
20579
|
+
right: 0;
|
|
20580
|
+
left: auto;
|
|
20581
|
+
transform-origin: right;
|
|
20582
|
+
background: linear-gradient(to left, var(--background-color) 10%, transparent);
|
|
20583
|
+
}
|
|
20584
|
+
`;
|
|
20585
|
+
var segmentedControlScrollIndicatorStartVisibleStyles = css92`
|
|
20586
|
+
&::before {
|
|
20587
|
+
opacity: 1;
|
|
20588
|
+
}
|
|
20589
|
+
`;
|
|
20590
|
+
var segmentedControlScrollIndicatorEndVisibleStyles = css92`
|
|
20591
|
+
&::after {
|
|
20592
|
+
opacity: 1;
|
|
20593
|
+
}
|
|
20594
|
+
`;
|
|
20595
|
+
var segmentedControlWrapperStyles = css92`
|
|
20596
|
+
overflow-y: auto;
|
|
20597
|
+
scroll-behavior: smooth;
|
|
20598
|
+
scrollbar-width: none;
|
|
20599
|
+
&::-webkit-scrollbar {
|
|
20600
|
+
width: 0px;
|
|
20601
|
+
height: 0px;
|
|
20602
|
+
}
|
|
20603
|
+
`;
|
|
20553
20604
|
var segmentedControlStyles = css92`
|
|
20554
20605
|
--segmented-control-rounded-value: var(--rounded-base);
|
|
20555
20606
|
--segmented-control-border-width: 1px;
|
|
@@ -20667,7 +20718,9 @@ var segmentedControlLabelContentStyles = css92`
|
|
|
20667
20718
|
gap: var(--spacing-sm);
|
|
20668
20719
|
height: 100%;
|
|
20669
20720
|
`;
|
|
20670
|
-
var segmentedControlLabelTextStyles = css92
|
|
20721
|
+
var segmentedControlLabelTextStyles = css92`
|
|
20722
|
+
white-space: nowrap;
|
|
20723
|
+
`;
|
|
20671
20724
|
|
|
20672
20725
|
// src/components/SegmentedControl/SegmentedControl.tsx
|
|
20673
20726
|
import { jsx as jsx121, jsxs as jsxs81 } from "@emotion/react/jsx-runtime";
|
|
@@ -20682,8 +20735,12 @@ var SegmentedControl = ({
|
|
|
20682
20735
|
size = "md",
|
|
20683
20736
|
hideOptionText = false,
|
|
20684
20737
|
iconSize = "1.5em",
|
|
20738
|
+
currentBackgroundColor = "white",
|
|
20685
20739
|
...props
|
|
20686
20740
|
}) => {
|
|
20741
|
+
const wrapperRef = useRef9(null);
|
|
20742
|
+
const [isOverflowStartShadowVisible, setIsOverflowStartShadowVisible] = useState16(false);
|
|
20743
|
+
const [isOverflowEndShadowVisible, setIsOverflowEndShadowVisible] = useState16(false);
|
|
20687
20744
|
const onOptionChange = useCallback10(
|
|
20688
20745
|
(event) => {
|
|
20689
20746
|
if (event.target.checked) {
|
|
@@ -20704,58 +20761,94 @@ var SegmentedControl = ({
|
|
|
20704
20761
|
const isIconOnly = useMemo6(() => {
|
|
20705
20762
|
return options.every((option) => option && option.icon && !option.label);
|
|
20706
20763
|
}, [options]);
|
|
20707
|
-
|
|
20708
|
-
|
|
20709
|
-
{
|
|
20710
|
-
|
|
20711
|
-
|
|
20712
|
-
|
|
20713
|
-
|
|
20714
|
-
|
|
20715
|
-
|
|
20716
|
-
|
|
20717
|
-
|
|
20718
|
-
|
|
20719
|
-
|
|
20720
|
-
|
|
20721
|
-
|
|
20722
|
-
|
|
20723
|
-
|
|
20724
|
-
|
|
20725
|
-
|
|
20726
|
-
|
|
20727
|
-
|
|
20728
|
-
|
|
20729
|
-
|
|
20730
|
-
|
|
20731
|
-
|
|
20732
|
-
|
|
20733
|
-
|
|
20734
|
-
|
|
20735
|
-
|
|
20736
|
-
|
|
20737
|
-
|
|
20738
|
-
|
|
20739
|
-
|
|
20740
|
-
|
|
20741
|
-
|
|
20742
|
-
onChange: onOptionChange,
|
|
20743
|
-
disabled: isDisabled
|
|
20744
|
-
}
|
|
20745
|
-
),
|
|
20746
|
-
option.value !== value || noCheckmark ? null : /* @__PURE__ */ jsx121(CgCheck4, { css: segmentedControlLabelCheckStyles, "aria-label": "Selected", size: "1.5em" }),
|
|
20747
|
-
/* @__PURE__ */ jsxs81("span", { css: segmentedControlLabelContentStyles, children: [
|
|
20748
|
-
!option.icon ? null : /* @__PURE__ */ jsx121(Icon, { icon: option.icon, size: iconSize, iconColor: "currentColor" }),
|
|
20749
|
-
!text || hideOptionText ? null : /* @__PURE__ */ jsx121("span", { css: segmentedControlLabelTextStyles, children: text })
|
|
20750
|
-
] })
|
|
20751
|
-
]
|
|
20752
|
-
}
|
|
20753
|
-
)
|
|
20764
|
+
useEffect17(() => {
|
|
20765
|
+
const wrapperElement = wrapperRef.current;
|
|
20766
|
+
const onScroll = () => {
|
|
20767
|
+
if (!wrapperElement) {
|
|
20768
|
+
return;
|
|
20769
|
+
}
|
|
20770
|
+
const scrollValue = wrapperElement.scrollLeft;
|
|
20771
|
+
const maxScroll = wrapperElement.scrollWidth - wrapperElement.clientWidth;
|
|
20772
|
+
const isScrollable = wrapperElement.scrollWidth >= wrapperElement.clientWidth;
|
|
20773
|
+
const toleranceMargin = 4;
|
|
20774
|
+
const isAtScrollStart = scrollValue < toleranceMargin;
|
|
20775
|
+
const isAtScrollEnd = scrollValue >= maxScroll - toleranceMargin;
|
|
20776
|
+
setIsOverflowStartShadowVisible(isScrollable && !isAtScrollStart);
|
|
20777
|
+
setIsOverflowEndShadowVisible(isScrollable && !isAtScrollEnd);
|
|
20778
|
+
};
|
|
20779
|
+
onScroll();
|
|
20780
|
+
wrapperElement == null ? void 0 : wrapperElement.addEventListener("scroll", onScroll);
|
|
20781
|
+
return () => {
|
|
20782
|
+
wrapperElement == null ? void 0 : wrapperElement.removeEventListener("scroll", onScroll);
|
|
20783
|
+
};
|
|
20784
|
+
}, []);
|
|
20785
|
+
return /* @__PURE__ */ jsxs81("div", { css: [segmentedControlRootStyles, { "--background-color": currentBackgroundColor }], children: [
|
|
20786
|
+
/* @__PURE__ */ jsx121("div", { ref: wrapperRef, css: segmentedControlWrapperStyles, children: /* @__PURE__ */ jsx121(
|
|
20787
|
+
"div",
|
|
20788
|
+
{
|
|
20789
|
+
css: [
|
|
20790
|
+
segmentedControlStyles,
|
|
20791
|
+
orientation === "vertical" ? segmentedControlVerticalStyles : void 0
|
|
20792
|
+
],
|
|
20793
|
+
...props,
|
|
20794
|
+
"data-testid": "segmented-control",
|
|
20795
|
+
children: options.map((option, index) => {
|
|
20796
|
+
var _a;
|
|
20797
|
+
if (!option) {
|
|
20798
|
+
return null;
|
|
20754
20799
|
}
|
|
20755
|
-
|
|
20756
|
-
|
|
20757
|
-
|
|
20758
|
-
|
|
20800
|
+
const text = option.label ? option.label : option.icon ? null : String(option.value);
|
|
20801
|
+
const isDisabled = disabled2 || option.disabled;
|
|
20802
|
+
return /* @__PURE__ */ jsx121(Tooltip, { title: (_a = option.tooltip) != null ? _a : "", children: /* @__PURE__ */ jsx121(
|
|
20803
|
+
"div",
|
|
20804
|
+
{
|
|
20805
|
+
css: segmentedControlItemStyles,
|
|
20806
|
+
"data-testid": option["data-testid"] ? option["data-testid"] : "container-segmented-control",
|
|
20807
|
+
children: /* @__PURE__ */ jsxs81(
|
|
20808
|
+
"label",
|
|
20809
|
+
{
|
|
20810
|
+
css: [
|
|
20811
|
+
segmentedControlLabelStyles(option.value === value, isDisabled),
|
|
20812
|
+
sizeStyles,
|
|
20813
|
+
isIconOnly ? segmentedControlLabelIconOnlyStyles : void 0
|
|
20814
|
+
],
|
|
20815
|
+
children: [
|
|
20816
|
+
/* @__PURE__ */ jsx121(
|
|
20817
|
+
"input",
|
|
20818
|
+
{
|
|
20819
|
+
css: segmentedControlInputStyles,
|
|
20820
|
+
type: "radio",
|
|
20821
|
+
name,
|
|
20822
|
+
value: index,
|
|
20823
|
+
checked: option.value === value,
|
|
20824
|
+
onChange: onOptionChange,
|
|
20825
|
+
disabled: isDisabled
|
|
20826
|
+
}
|
|
20827
|
+
),
|
|
20828
|
+
option.value !== value || noCheckmark ? null : /* @__PURE__ */ jsx121(CgCheck4, { css: segmentedControlLabelCheckStyles, "aria-label": "Selected", size: "1.5em" }),
|
|
20829
|
+
/* @__PURE__ */ jsxs81("span", { css: segmentedControlLabelContentStyles, children: [
|
|
20830
|
+
!option.icon ? null : /* @__PURE__ */ jsx121(Icon, { icon: option.icon, size: iconSize, iconColor: "currentColor" }),
|
|
20831
|
+
!text || hideOptionText ? null : /* @__PURE__ */ jsx121("span", { css: segmentedControlLabelTextStyles, children: text })
|
|
20832
|
+
] })
|
|
20833
|
+
]
|
|
20834
|
+
}
|
|
20835
|
+
)
|
|
20836
|
+
}
|
|
20837
|
+
) }, JSON.stringify(option.value));
|
|
20838
|
+
})
|
|
20839
|
+
}
|
|
20840
|
+
) }),
|
|
20841
|
+
/* @__PURE__ */ jsx121(
|
|
20842
|
+
"div",
|
|
20843
|
+
{
|
|
20844
|
+
css: [
|
|
20845
|
+
segmentedControlScrollIndicatorsStyles,
|
|
20846
|
+
isOverflowStartShadowVisible ? segmentedControlScrollIndicatorStartVisibleStyles : null,
|
|
20847
|
+
isOverflowEndShadowVisible ? segmentedControlScrollIndicatorEndVisibleStyles : null
|
|
20848
|
+
]
|
|
20849
|
+
}
|
|
20850
|
+
)
|
|
20851
|
+
] });
|
|
20759
20852
|
};
|
|
20760
20853
|
|
|
20761
20854
|
// src/components/Skeleton/Skeleton.styles.ts
|
|
@@ -20979,7 +21072,7 @@ import {
|
|
|
20979
21072
|
TabProvider as AriakitTabProvider,
|
|
20980
21073
|
useTabStore as useAriakitTabStore
|
|
20981
21074
|
} from "@ariakit/react";
|
|
20982
|
-
import { useCallback as useCallback11, useEffect as
|
|
21075
|
+
import { useCallback as useCallback11, useEffect as useEffect18, useMemo as useMemo7 } from "react";
|
|
20983
21076
|
|
|
20984
21077
|
// src/components/Tabs/Tabs.styles.ts
|
|
20985
21078
|
import { css as css97 } from "@emotion/react";
|
|
@@ -21040,7 +21133,7 @@ var Tabs = ({
|
|
|
21040
21133
|
},
|
|
21041
21134
|
[onSelectedIdChange, useHashForState]
|
|
21042
21135
|
);
|
|
21043
|
-
|
|
21136
|
+
useEffect18(() => {
|
|
21044
21137
|
if (selected && selected !== tab.getState().activeId) {
|
|
21045
21138
|
tab.setSelectedId(selected);
|
|
21046
21139
|
}
|
package/dist/index.d.mts
CHANGED
|
@@ -23116,12 +23116,17 @@ type SegmentedControlProps<TValue extends string = string> = Omit<React__default
|
|
|
23116
23116
|
* @default '1.5em'
|
|
23117
23117
|
*/
|
|
23118
23118
|
iconSize?: string;
|
|
23119
|
+
/**
|
|
23120
|
+
* This is used to match the color of the scroll indicators with the background color of the parent.
|
|
23121
|
+
* @default 'white'
|
|
23122
|
+
*/
|
|
23123
|
+
currentBackgroundColor?: React__default.CSSProperties['backgroundColor'];
|
|
23119
23124
|
};
|
|
23120
23125
|
/**
|
|
23121
|
-
*
|
|
23126
|
+
* A control with multiple segments. Can be used as a replacement of radio buttons.
|
|
23122
23127
|
* @example <SegmentedControl name="mySegmentedControl" value={value} options={[{label: 'Option 1', value: 'option1',label: 'Option 2', value: 'option2'}]} onChange={setValue} />
|
|
23123
23128
|
*/
|
|
23124
|
-
declare const SegmentedControl: <TValue extends string = string>({ name, options, value, onChange, noCheckmark, disabled, orientation, size, hideOptionText, iconSize, ...props }: SegmentedControlProps<TValue>) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
23129
|
+
declare const SegmentedControl: <TValue extends string = string>({ name, options, value, onChange, noCheckmark, disabled, orientation, size, hideOptionText, iconSize, currentBackgroundColor, ...props }: SegmentedControlProps<TValue>) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
23125
23130
|
|
|
23126
23131
|
declare function ShortcutContext({ children }: {
|
|
23127
23132
|
children: React__default.ReactNode;
|
package/dist/index.d.ts
CHANGED
|
@@ -23116,12 +23116,17 @@ type SegmentedControlProps<TValue extends string = string> = Omit<React__default
|
|
|
23116
23116
|
* @default '1.5em'
|
|
23117
23117
|
*/
|
|
23118
23118
|
iconSize?: string;
|
|
23119
|
+
/**
|
|
23120
|
+
* This is used to match the color of the scroll indicators with the background color of the parent.
|
|
23121
|
+
* @default 'white'
|
|
23122
|
+
*/
|
|
23123
|
+
currentBackgroundColor?: React__default.CSSProperties['backgroundColor'];
|
|
23119
23124
|
};
|
|
23120
23125
|
/**
|
|
23121
|
-
*
|
|
23126
|
+
* A control with multiple segments. Can be used as a replacement of radio buttons.
|
|
23122
23127
|
* @example <SegmentedControl name="mySegmentedControl" value={value} options={[{label: 'Option 1', value: 'option1',label: 'Option 2', value: 'option2'}]} onChange={setValue} />
|
|
23123
23128
|
*/
|
|
23124
|
-
declare const SegmentedControl: <TValue extends string = string>({ name, options, value, onChange, noCheckmark, disabled, orientation, size, hideOptionText, iconSize, ...props }: SegmentedControlProps<TValue>) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
23129
|
+
declare const SegmentedControl: <TValue extends string = string>({ name, options, value, onChange, noCheckmark, disabled, orientation, size, hideOptionText, iconSize, currentBackgroundColor, ...props }: SegmentedControlProps<TValue>) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
23125
23130
|
|
|
23126
23131
|
declare function ShortcutContext({ children }: {
|
|
23127
23132
|
children: React__default.ReactNode;
|
package/dist/index.js
CHANGED
|
@@ -13590,6 +13590,7 @@ var TooltipContainer = import_react31.css`
|
|
|
13590
13590
|
color: var(--gray-500);
|
|
13591
13591
|
font-size: var(--fs-xs);
|
|
13592
13592
|
background: var(--white);
|
|
13593
|
+
position: relative;
|
|
13593
13594
|
`;
|
|
13594
13595
|
var TooltipArrowStyles = import_react31.css`
|
|
13595
13596
|
svg {
|
|
@@ -22380,6 +22381,56 @@ var import_react143 = require("react");
|
|
|
22380
22381
|
// src/components/SegmentedControl/SegmentedControl.styles.ts
|
|
22381
22382
|
init_emotion_jsx_shim();
|
|
22382
22383
|
var import_react141 = require("@emotion/react");
|
|
22384
|
+
var segmentedControlRootStyles = import_react141.css`
|
|
22385
|
+
position: relative;
|
|
22386
|
+
`;
|
|
22387
|
+
var segmentedControlScrollIndicatorsStyles = import_react141.css`
|
|
22388
|
+
position: absolute;
|
|
22389
|
+
inset: 0;
|
|
22390
|
+
z-index: 1;
|
|
22391
|
+
pointer-events: none;
|
|
22392
|
+
|
|
22393
|
+
&::before,
|
|
22394
|
+
&::after {
|
|
22395
|
+
content: '';
|
|
22396
|
+
display: block;
|
|
22397
|
+
position: absolute;
|
|
22398
|
+
top: 0;
|
|
22399
|
+
bottom: 0;
|
|
22400
|
+
left: 0;
|
|
22401
|
+
width: var(--spacing-sm);
|
|
22402
|
+
background: linear-gradient(to right, var(--background-color) 10%, transparent);
|
|
22403
|
+
opacity: 0;
|
|
22404
|
+
transform-origin: left;
|
|
22405
|
+
transition: opacity var(--duration-xfast) ease-in-out;
|
|
22406
|
+
}
|
|
22407
|
+
|
|
22408
|
+
&::after {
|
|
22409
|
+
right: 0;
|
|
22410
|
+
left: auto;
|
|
22411
|
+
transform-origin: right;
|
|
22412
|
+
background: linear-gradient(to left, var(--background-color) 10%, transparent);
|
|
22413
|
+
}
|
|
22414
|
+
`;
|
|
22415
|
+
var segmentedControlScrollIndicatorStartVisibleStyles = import_react141.css`
|
|
22416
|
+
&::before {
|
|
22417
|
+
opacity: 1;
|
|
22418
|
+
}
|
|
22419
|
+
`;
|
|
22420
|
+
var segmentedControlScrollIndicatorEndVisibleStyles = import_react141.css`
|
|
22421
|
+
&::after {
|
|
22422
|
+
opacity: 1;
|
|
22423
|
+
}
|
|
22424
|
+
`;
|
|
22425
|
+
var segmentedControlWrapperStyles = import_react141.css`
|
|
22426
|
+
overflow-y: auto;
|
|
22427
|
+
scroll-behavior: smooth;
|
|
22428
|
+
scrollbar-width: none;
|
|
22429
|
+
&::-webkit-scrollbar {
|
|
22430
|
+
width: 0px;
|
|
22431
|
+
height: 0px;
|
|
22432
|
+
}
|
|
22433
|
+
`;
|
|
22383
22434
|
var segmentedControlStyles = import_react141.css`
|
|
22384
22435
|
--segmented-control-rounded-value: var(--rounded-base);
|
|
22385
22436
|
--segmented-control-border-width: 1px;
|
|
@@ -22497,7 +22548,9 @@ var segmentedControlLabelContentStyles = import_react141.css`
|
|
|
22497
22548
|
gap: var(--spacing-sm);
|
|
22498
22549
|
height: 100%;
|
|
22499
22550
|
`;
|
|
22500
|
-
var segmentedControlLabelTextStyles = import_react141.css
|
|
22551
|
+
var segmentedControlLabelTextStyles = import_react141.css`
|
|
22552
|
+
white-space: nowrap;
|
|
22553
|
+
`;
|
|
22501
22554
|
|
|
22502
22555
|
// src/components/SegmentedControl/SegmentedControl.tsx
|
|
22503
22556
|
var import_jsx_runtime121 = require("@emotion/react/jsx-runtime");
|
|
@@ -22512,8 +22565,12 @@ var SegmentedControl = ({
|
|
|
22512
22565
|
size = "md",
|
|
22513
22566
|
hideOptionText = false,
|
|
22514
22567
|
iconSize = "1.5em",
|
|
22568
|
+
currentBackgroundColor = "white",
|
|
22515
22569
|
...props
|
|
22516
22570
|
}) => {
|
|
22571
|
+
const wrapperRef = (0, import_react143.useRef)(null);
|
|
22572
|
+
const [isOverflowStartShadowVisible, setIsOverflowStartShadowVisible] = (0, import_react143.useState)(false);
|
|
22573
|
+
const [isOverflowEndShadowVisible, setIsOverflowEndShadowVisible] = (0, import_react143.useState)(false);
|
|
22517
22574
|
const onOptionChange = (0, import_react143.useCallback)(
|
|
22518
22575
|
(event) => {
|
|
22519
22576
|
if (event.target.checked) {
|
|
@@ -22534,58 +22591,94 @@ var SegmentedControl = ({
|
|
|
22534
22591
|
const isIconOnly = (0, import_react143.useMemo)(() => {
|
|
22535
22592
|
return options.every((option) => option && option.icon && !option.label);
|
|
22536
22593
|
}, [options]);
|
|
22537
|
-
|
|
22538
|
-
|
|
22539
|
-
{
|
|
22540
|
-
|
|
22541
|
-
|
|
22542
|
-
|
|
22543
|
-
|
|
22544
|
-
|
|
22545
|
-
|
|
22546
|
-
|
|
22547
|
-
|
|
22548
|
-
|
|
22549
|
-
|
|
22550
|
-
|
|
22551
|
-
|
|
22552
|
-
|
|
22553
|
-
|
|
22554
|
-
|
|
22555
|
-
|
|
22556
|
-
|
|
22557
|
-
|
|
22558
|
-
|
|
22559
|
-
|
|
22560
|
-
|
|
22561
|
-
|
|
22562
|
-
|
|
22563
|
-
|
|
22564
|
-
|
|
22565
|
-
|
|
22566
|
-
|
|
22567
|
-
|
|
22568
|
-
|
|
22569
|
-
|
|
22570
|
-
|
|
22571
|
-
|
|
22572
|
-
onChange: onOptionChange,
|
|
22573
|
-
disabled: isDisabled
|
|
22574
|
-
}
|
|
22575
|
-
),
|
|
22576
|
-
option.value !== value || noCheckmark ? null : /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(import_CgCheck5.CgCheck, { css: segmentedControlLabelCheckStyles, "aria-label": "Selected", size: "1.5em" }),
|
|
22577
|
-
/* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("span", { css: segmentedControlLabelContentStyles, children: [
|
|
22578
|
-
!option.icon ? null : /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(Icon, { icon: option.icon, size: iconSize, iconColor: "currentColor" }),
|
|
22579
|
-
!text || hideOptionText ? null : /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { css: segmentedControlLabelTextStyles, children: text })
|
|
22580
|
-
] })
|
|
22581
|
-
]
|
|
22582
|
-
}
|
|
22583
|
-
)
|
|
22594
|
+
(0, import_react143.useEffect)(() => {
|
|
22595
|
+
const wrapperElement = wrapperRef.current;
|
|
22596
|
+
const onScroll = () => {
|
|
22597
|
+
if (!wrapperElement) {
|
|
22598
|
+
return;
|
|
22599
|
+
}
|
|
22600
|
+
const scrollValue = wrapperElement.scrollLeft;
|
|
22601
|
+
const maxScroll = wrapperElement.scrollWidth - wrapperElement.clientWidth;
|
|
22602
|
+
const isScrollable = wrapperElement.scrollWidth >= wrapperElement.clientWidth;
|
|
22603
|
+
const toleranceMargin = 4;
|
|
22604
|
+
const isAtScrollStart = scrollValue < toleranceMargin;
|
|
22605
|
+
const isAtScrollEnd = scrollValue >= maxScroll - toleranceMargin;
|
|
22606
|
+
setIsOverflowStartShadowVisible(isScrollable && !isAtScrollStart);
|
|
22607
|
+
setIsOverflowEndShadowVisible(isScrollable && !isAtScrollEnd);
|
|
22608
|
+
};
|
|
22609
|
+
onScroll();
|
|
22610
|
+
wrapperElement == null ? void 0 : wrapperElement.addEventListener("scroll", onScroll);
|
|
22611
|
+
return () => {
|
|
22612
|
+
wrapperElement == null ? void 0 : wrapperElement.removeEventListener("scroll", onScroll);
|
|
22613
|
+
};
|
|
22614
|
+
}, []);
|
|
22615
|
+
return /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("div", { css: [segmentedControlRootStyles, { "--background-color": currentBackgroundColor }], children: [
|
|
22616
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)("div", { ref: wrapperRef, css: segmentedControlWrapperStyles, children: /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
|
|
22617
|
+
"div",
|
|
22618
|
+
{
|
|
22619
|
+
css: [
|
|
22620
|
+
segmentedControlStyles,
|
|
22621
|
+
orientation === "vertical" ? segmentedControlVerticalStyles : void 0
|
|
22622
|
+
],
|
|
22623
|
+
...props,
|
|
22624
|
+
"data-testid": "segmented-control",
|
|
22625
|
+
children: options.map((option, index) => {
|
|
22626
|
+
var _a;
|
|
22627
|
+
if (!option) {
|
|
22628
|
+
return null;
|
|
22584
22629
|
}
|
|
22585
|
-
|
|
22586
|
-
|
|
22587
|
-
|
|
22588
|
-
|
|
22630
|
+
const text = option.label ? option.label : option.icon ? null : String(option.value);
|
|
22631
|
+
const isDisabled = disabled2 || option.disabled;
|
|
22632
|
+
return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(Tooltip, { title: (_a = option.tooltip) != null ? _a : "", children: /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
|
|
22633
|
+
"div",
|
|
22634
|
+
{
|
|
22635
|
+
css: segmentedControlItemStyles,
|
|
22636
|
+
"data-testid": option["data-testid"] ? option["data-testid"] : "container-segmented-control",
|
|
22637
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)(
|
|
22638
|
+
"label",
|
|
22639
|
+
{
|
|
22640
|
+
css: [
|
|
22641
|
+
segmentedControlLabelStyles(option.value === value, isDisabled),
|
|
22642
|
+
sizeStyles,
|
|
22643
|
+
isIconOnly ? segmentedControlLabelIconOnlyStyles : void 0
|
|
22644
|
+
],
|
|
22645
|
+
children: [
|
|
22646
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
|
|
22647
|
+
"input",
|
|
22648
|
+
{
|
|
22649
|
+
css: segmentedControlInputStyles,
|
|
22650
|
+
type: "radio",
|
|
22651
|
+
name,
|
|
22652
|
+
value: index,
|
|
22653
|
+
checked: option.value === value,
|
|
22654
|
+
onChange: onOptionChange,
|
|
22655
|
+
disabled: isDisabled
|
|
22656
|
+
}
|
|
22657
|
+
),
|
|
22658
|
+
option.value !== value || noCheckmark ? null : /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(import_CgCheck5.CgCheck, { css: segmentedControlLabelCheckStyles, "aria-label": "Selected", size: "1.5em" }),
|
|
22659
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("span", { css: segmentedControlLabelContentStyles, children: [
|
|
22660
|
+
!option.icon ? null : /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(Icon, { icon: option.icon, size: iconSize, iconColor: "currentColor" }),
|
|
22661
|
+
!text || hideOptionText ? null : /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { css: segmentedControlLabelTextStyles, children: text })
|
|
22662
|
+
] })
|
|
22663
|
+
]
|
|
22664
|
+
}
|
|
22665
|
+
)
|
|
22666
|
+
}
|
|
22667
|
+
) }, JSON.stringify(option.value));
|
|
22668
|
+
})
|
|
22669
|
+
}
|
|
22670
|
+
) }),
|
|
22671
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
|
|
22672
|
+
"div",
|
|
22673
|
+
{
|
|
22674
|
+
css: [
|
|
22675
|
+
segmentedControlScrollIndicatorsStyles,
|
|
22676
|
+
isOverflowStartShadowVisible ? segmentedControlScrollIndicatorStartVisibleStyles : null,
|
|
22677
|
+
isOverflowEndShadowVisible ? segmentedControlScrollIndicatorEndVisibleStyles : null
|
|
22678
|
+
]
|
|
22679
|
+
}
|
|
22680
|
+
)
|
|
22681
|
+
] });
|
|
22589
22682
|
};
|
|
22590
22683
|
|
|
22591
22684
|
// src/components/Skeleton/Skeleton.tsx
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/design-system",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.149.1-alpha.1+55ee398800",
|
|
4
4
|
"description": "Uniform design system components",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"@storybook/react": "6.5.16",
|
|
25
25
|
"@types/react": "18.2.40",
|
|
26
26
|
"@types/react-dom": "18.2.17",
|
|
27
|
-
"@uniformdev/canvas": "^19.
|
|
28
|
-
"@uniformdev/richtext": "^19.
|
|
27
|
+
"@uniformdev/canvas": "^19.149.1-alpha.1+55ee398800",
|
|
28
|
+
"@uniformdev/richtext": "^19.149.1-alpha.1+55ee398800",
|
|
29
29
|
"autoprefixer": "10.4.16",
|
|
30
30
|
"hygen": "6.2.11",
|
|
31
31
|
"postcss": "8.4.38",
|
|
@@ -72,5 +72,5 @@
|
|
|
72
72
|
"publishConfig": {
|
|
73
73
|
"access": "public"
|
|
74
74
|
},
|
|
75
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "55ee398800ebfebe4d493572e47f5474b6125ddf"
|
|
76
76
|
}
|