@wistia/ui 1.9.1-beta.491f6847.136e8d0 → 1.9.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/CHANGELOG.md +2295 -0
- package/dist/index.d.ts +1 -86
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +176 -362
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
/*
|
|
3
|
-
* @license @wistia/ui v1.9.1
|
|
3
|
+
* @license @wistia/ui v1.9.1
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2024-2026, Wistia, Inc. and its affiliates.
|
|
6
6
|
*
|
|
@@ -7483,7 +7483,7 @@ const CheckboxGroup = ({ children, name, onChange, value, ...props }) => {
|
|
|
7483
7483
|
CheckboxGroup.displayName = "CheckboxGroup_UI";
|
|
7484
7484
|
//#endregion
|
|
7485
7485
|
//#region src/components/Checkbox/Checkbox.tsx
|
|
7486
|
-
const CheckIcon
|
|
7486
|
+
const CheckIcon = () => /* @__PURE__ */ jsx("svg", {
|
|
7487
7487
|
fill: "inherit",
|
|
7488
7488
|
height: "8",
|
|
7489
7489
|
viewBox: "0 0 10 8",
|
|
@@ -7611,7 +7611,7 @@ const Checkbox = ({ checked, disabled = false, id, label, description, name, onC
|
|
|
7611
7611
|
$disabled: disabled,
|
|
7612
7612
|
$size: size,
|
|
7613
7613
|
"data-wui-faux-input": "true",
|
|
7614
|
-
children: /* @__PURE__ */ jsx(CheckIcon
|
|
7614
|
+
children: /* @__PURE__ */ jsx(CheckIcon, {})
|
|
7615
7615
|
}),
|
|
7616
7616
|
description,
|
|
7617
7617
|
disabled,
|
|
@@ -7622,364 +7622,6 @@ const Checkbox = ({ checked, disabled = false, id, label, description, name, onC
|
|
|
7622
7622
|
});
|
|
7623
7623
|
};
|
|
7624
7624
|
//#endregion
|
|
7625
|
-
//#region src/components/CheckboxCard/CheckboxCardChildrenContainer.tsx
|
|
7626
|
-
const CheckboxCardChildrenContainer = styled.div`
|
|
7627
|
-
flex: 1 1 auto;
|
|
7628
|
-
`;
|
|
7629
|
-
//#endregion
|
|
7630
|
-
//#region src/components/FormGroup/RadioGroup.tsx
|
|
7631
|
-
const RadioGroupContext = createContext(null);
|
|
7632
|
-
/**
|
|
7633
|
-
* Connects Radio components with their parent RadioGroup; provides access to `name` and `onChange`
|
|
7634
|
-
*/
|
|
7635
|
-
const useRadioGroup = () => {
|
|
7636
|
-
return useContext(RadioGroupContext);
|
|
7637
|
-
};
|
|
7638
|
-
/**
|
|
7639
|
-
* For grouping like form elements together. Can serve as a checkbox
|
|
7640
|
-
*/
|
|
7641
|
-
const RadioGroup = ({ children, name, onChange, value, ...props }) => {
|
|
7642
|
-
const formState = useContext(FormContext);
|
|
7643
|
-
const derivedValue = typeof formState.values[name] === "string" ? formState.values[name] : value;
|
|
7644
|
-
const context = useMemo(() => {
|
|
7645
|
-
return {
|
|
7646
|
-
name,
|
|
7647
|
-
onChange,
|
|
7648
|
-
value: derivedValue
|
|
7649
|
-
};
|
|
7650
|
-
}, [
|
|
7651
|
-
name,
|
|
7652
|
-
derivedValue,
|
|
7653
|
-
onChange
|
|
7654
|
-
]);
|
|
7655
|
-
return /* @__PURE__ */ jsx(RadioGroupContext, {
|
|
7656
|
-
value: context,
|
|
7657
|
-
children: /* @__PURE__ */ jsx(FormGroup, {
|
|
7658
|
-
...props,
|
|
7659
|
-
role: "radiogroup",
|
|
7660
|
-
children
|
|
7661
|
-
})
|
|
7662
|
-
});
|
|
7663
|
-
};
|
|
7664
|
-
RadioGroup.displayName = "RadioGroup_UI";
|
|
7665
|
-
//#endregion
|
|
7666
|
-
//#region src/components/RadioCard/RadioCardRoot.tsx
|
|
7667
|
-
const checkedStyles = css`
|
|
7668
|
-
--wui-radio-card-border-color: var(--wui-color-focus-ring);
|
|
7669
|
-
--wui-color-icon: var(--wui-color-icon-selected);
|
|
7670
|
-
--wui-radio-card-background-color: var(--wui-color-bg-surface-info);
|
|
7671
|
-
--wui-color-text: var(--wui-color-text-info);
|
|
7672
|
-
--wui-color-text-secondary: var(--wui-color-text-info);
|
|
7673
|
-
`;
|
|
7674
|
-
const disabledStyles = css`
|
|
7675
|
-
--wui-radio-card-border-color: var(--wui-color-border-disabled);
|
|
7676
|
-
--wui-radio-card-background-color: var(--wui-color-bg-surface-disabled);
|
|
7677
|
-
--wui-radio-card-cursor: not-allowed;
|
|
7678
|
-
--wui-color-icon: var(--wui-color-icon-disabled);
|
|
7679
|
-
--wui-color-text: var(--wui-color-text-disabled);
|
|
7680
|
-
--wui-color-text-secondary: var(--wui-color-text-disabled);
|
|
7681
|
-
`;
|
|
7682
|
-
const focusStyles = css`
|
|
7683
|
-
outline: 2px solid var(--wui-color-focus-ring);
|
|
7684
|
-
`;
|
|
7685
|
-
const imageCoverStyles = css`
|
|
7686
|
-
--wui-radio-card-image-inset: 0px;
|
|
7687
|
-
--wui-radio-card-border-width: 0px;
|
|
7688
|
-
--wui-inset-shadow-width: 1px;
|
|
7689
|
-
--wui-radio-card-border-color: rgb(0 0 0 / 25%);
|
|
7690
|
-
|
|
7691
|
-
overflow: hidden;
|
|
7692
|
-
|
|
7693
|
-
&:has(input:checked) {
|
|
7694
|
-
--wui-radio-card-border-color: var(--wui-color-focus-ring);
|
|
7695
|
-
--wui-radio-card-image-inset: 2px;
|
|
7696
|
-
--wui-inset-shadow-width: 2px;
|
|
7697
|
-
}
|
|
7698
|
-
|
|
7699
|
-
&:hover:not(:has(input:disabled, input:checked)) {
|
|
7700
|
-
--wui-radio-card-border-color: rgb(0 0 0 / 50%);
|
|
7701
|
-
}
|
|
7702
|
-
|
|
7703
|
-
&::after {
|
|
7704
|
-
content: '';
|
|
7705
|
-
position: absolute;
|
|
7706
|
-
top: 0;
|
|
7707
|
-
width: 100%;
|
|
7708
|
-
height: 100%;
|
|
7709
|
-
border-radius: var(--wui-radio-card-border-radius);
|
|
7710
|
-
box-shadow:
|
|
7711
|
-
inset 0 0 0 var(--wui-inset-shadow-width) var(--wui-radio-card-border-color),
|
|
7712
|
-
inset 0 0 0 calc(var(--wui-radio-card-image-inset) * 2) var(--wui-radio-card-background-color);
|
|
7713
|
-
transition: all var(--wui-motion-duration-02) var(--wui-motion-ease);
|
|
7714
|
-
}
|
|
7715
|
-
`;
|
|
7716
|
-
const StyledCard = styled.label`
|
|
7717
|
-
--wui-radio-card-border-color: var(--wui-color-border-secondary);
|
|
7718
|
-
--wui-radio-card-background-color: var(--wui-color-bg-surface);
|
|
7719
|
-
--wui-radio-card-cursor: pointer;
|
|
7720
|
-
--wui-radio-card-border-width: 1px;
|
|
7721
|
-
--wui-radio-card-border-radius: var(--wui-border-radius-02);
|
|
7722
|
-
|
|
7723
|
-
position: relative;
|
|
7724
|
-
display: inline-flex;
|
|
7725
|
-
padding: ${({ $padding }) => `var(--wui-${$padding})`};
|
|
7726
|
-
aspect-ratio: ${({ $aspectRatio }) => $aspectRatio};
|
|
7727
|
-
border: var(--wui-radio-card-border-width) solid var(--wui-radio-card-border-color);
|
|
7728
|
-
border-radius: var(--wui-radio-card-border-radius);
|
|
7729
|
-
background-color: var(--wui-radio-card-background-color);
|
|
7730
|
-
cursor: var(--wui-radio-card-cursor);
|
|
7731
|
-
overflow: hidden;
|
|
7732
|
-
transition: all var(--wui-motion-duration-03) var(--wui-motion-ease);
|
|
7733
|
-
|
|
7734
|
-
svg {
|
|
7735
|
-
transition: all var(--wui-motion-duration-03) var(--wui-motion-ease);
|
|
7736
|
-
}
|
|
7737
|
-
|
|
7738
|
-
&:hover {
|
|
7739
|
-
--wui-radio-card-border-color: var(--wui-color-border-secondary-hover);
|
|
7740
|
-
}
|
|
7741
|
-
|
|
7742
|
-
&:active {
|
|
7743
|
-
--wui-radio-card-border-color: var(--wui-color-border-secondary-active);
|
|
7744
|
-
}
|
|
7745
|
-
|
|
7746
|
-
&:has(input:checked) {
|
|
7747
|
-
${({ $isGated }) => $isGated ? getColorScheme("purple") : checkedStyles}
|
|
7748
|
-
}
|
|
7749
|
-
|
|
7750
|
-
&:has(input:disabled) {
|
|
7751
|
-
${disabledStyles}
|
|
7752
|
-
}
|
|
7753
|
-
|
|
7754
|
-
&:has(input:focus-visible) {
|
|
7755
|
-
${focusStyles}
|
|
7756
|
-
}
|
|
7757
|
-
|
|
7758
|
-
&:has([data-wui-radio-card-image]) {
|
|
7759
|
-
&:has(input:disabled) {
|
|
7760
|
-
& [data-wui-radio-card-image] {
|
|
7761
|
-
filter: grayscale(100%);
|
|
7762
|
-
}
|
|
7763
|
-
}
|
|
7764
|
-
|
|
7765
|
-
&:has([data-wui-radio-card-image='cover']) {
|
|
7766
|
-
${imageCoverStyles}
|
|
7767
|
-
}
|
|
7768
|
-
}
|
|
7769
|
-
`;
|
|
7770
|
-
const StyledHiddenInput$1 = styled.input`
|
|
7771
|
-
${visuallyHiddenStyle}
|
|
7772
|
-
`;
|
|
7773
|
-
const RadioCardRoot = ({ children, disabled = false, id, isGated = false, name, onChange, value, aspectRatio = "initial", padding = "space-04", checked, ref, ...props }) => {
|
|
7774
|
-
const generatedId = useId();
|
|
7775
|
-
const computedId = isNonEmptyString(id) ? id : `wistia-ui-radio-${generatedId}`;
|
|
7776
|
-
const radioGroupContext = useRadioGroup();
|
|
7777
|
-
const contextName = radioGroupContext?.name;
|
|
7778
|
-
const contextOnChange = radioGroupContext?.onChange;
|
|
7779
|
-
const contextValue = radioGroupContext?.value;
|
|
7780
|
-
const radioName = name ?? contextName;
|
|
7781
|
-
const handleOnChange = onChange ?? contextOnChange;
|
|
7782
|
-
const isChecked = isNotUndefined(value) && isNotUndefined(contextValue) ? contextValue === value : checked;
|
|
7783
|
-
return /* @__PURE__ */ jsxs(StyledCard, {
|
|
7784
|
-
$aspectRatio: aspectRatio,
|
|
7785
|
-
$isGated: isGated,
|
|
7786
|
-
$padding: padding,
|
|
7787
|
-
htmlFor: computedId,
|
|
7788
|
-
children: [/* @__PURE__ */ jsx(StyledHiddenInput$1, {
|
|
7789
|
-
...props,
|
|
7790
|
-
ref,
|
|
7791
|
-
checked: isChecked,
|
|
7792
|
-
disabled,
|
|
7793
|
-
id: computedId,
|
|
7794
|
-
name: radioName,
|
|
7795
|
-
onChange: handleOnChange,
|
|
7796
|
-
type: "radio",
|
|
7797
|
-
value
|
|
7798
|
-
}), children]
|
|
7799
|
-
});
|
|
7800
|
-
};
|
|
7801
|
-
//#endregion
|
|
7802
|
-
//#region src/components/CheckboxCard/CheckboxCardIndicator.tsx
|
|
7803
|
-
const CheckIcon = () => /* @__PURE__ */ jsx("svg", {
|
|
7804
|
-
fill: "inherit",
|
|
7805
|
-
height: "8",
|
|
7806
|
-
viewBox: "0 0 10 8",
|
|
7807
|
-
width: "10",
|
|
7808
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
7809
|
-
children: /* @__PURE__ */ jsx("path", {
|
|
7810
|
-
d: "M3.47281 7.19303L0.377565 4.07999C0.191609 3.89297 0.191609 3.58973 0.377565 3.40268L1.05098 2.72537C1.23694 2.53833 1.53847 2.53833 1.72442 2.72537L3.80953 4.82245L8.27558 0.330729C8.46154 0.143704 8.76306 0.143704 8.94902 0.330729L9.62244 1.00804C9.8084 1.19506 9.8084 1.49831 9.62244 1.68535L4.14624 7.19305C3.96027 7.38008 3.65876 7.38008 3.47281 7.19303Z",
|
|
7811
|
-
fill: "var(--wui-checkbox-card-indicator-icon-color)"
|
|
7812
|
-
})
|
|
7813
|
-
});
|
|
7814
|
-
const StyledIndicator = styled.div`
|
|
7815
|
-
--wui-checkbox-card-indicator-size: 14px;
|
|
7816
|
-
--wui-checkbox-card-indicator-icon-size: 7px;
|
|
7817
|
-
--wui-checkbox-card-indicator-background-color: var(--wui-color-bg-surface);
|
|
7818
|
-
--wui-checkbox-card-indicator-icon-color: transparent;
|
|
7819
|
-
|
|
7820
|
-
/* TODO: figure out radio / checkbox / switch colors */
|
|
7821
|
-
--wui-checkbox-card-indicator-border-color: var(--wui-color-border-secondary-active);
|
|
7822
|
-
|
|
7823
|
-
width: var(--wui-checkbox-card-indicator-size);
|
|
7824
|
-
height: var(--wui-checkbox-card-indicator-size);
|
|
7825
|
-
min-width: var(--wui-checkbox-card-indicator-size);
|
|
7826
|
-
min-height: var(--wui-checkbox-card-indicator-size);
|
|
7827
|
-
display: grid;
|
|
7828
|
-
place-content: center;
|
|
7829
|
-
background-color: var(--wui-checkbox-card-indicator-background-color);
|
|
7830
|
-
box-shadow: inset 0 0 0 1px var(--wui-checkbox-card-indicator-border-color);
|
|
7831
|
-
border-radius: var(--wui-border-radius-01);
|
|
7832
|
-
cursor: pointer;
|
|
7833
|
-
transition: all var(--wui-motion-duration-03) var(--wui-motion-ease);
|
|
7834
|
-
|
|
7835
|
-
/* check icon */
|
|
7836
|
-
svg {
|
|
7837
|
-
width: var(--wui-checkbox-card-indicator-icon-size);
|
|
7838
|
-
height: var(--wui-checkbox-card-indicator-icon-size);
|
|
7839
|
-
}
|
|
7840
|
-
|
|
7841
|
-
${StyledCard}:has(input:checked) & {
|
|
7842
|
-
--wui-checkbox-card-indicator-background-color: var(--wui-color-bg-fill);
|
|
7843
|
-
--wui-checkbox-card-indicator-border-color: transparent;
|
|
7844
|
-
--wui-checkbox-card-indicator-icon-color: var(--wui-color-bg-fill-white);
|
|
7845
|
-
}
|
|
7846
|
-
|
|
7847
|
-
${StyledCard}:has(input:disabled) & {
|
|
7848
|
-
--wui-checkbox-card-indicator-border-color: var(--wui-color-border-secondary);
|
|
7849
|
-
--wui-checkbox-card-indicator-background-color: var(--wui-color-bg-surface-disabled);
|
|
7850
|
-
}
|
|
7851
|
-
|
|
7852
|
-
${StyledCard}:has(input:disabled:checked) & {
|
|
7853
|
-
--wui-checkbox-card-indicator-icon-color: var(--wui-color-icon-disabled);
|
|
7854
|
-
}
|
|
7855
|
-
`;
|
|
7856
|
-
const CheckboxCardIndicator = (props) => /* @__PURE__ */ jsx(StyledIndicator, {
|
|
7857
|
-
...props,
|
|
7858
|
-
children: /* @__PURE__ */ jsx(CheckIcon, {})
|
|
7859
|
-
});
|
|
7860
|
-
CheckboxCardIndicator.displayName = "CheckboxCardIndicator_UI";
|
|
7861
|
-
//#endregion
|
|
7862
|
-
//#region src/components/CheckboxCard/CheckboxCardDefaultLayout.tsx
|
|
7863
|
-
const StyledCardContent$1 = styled.div`
|
|
7864
|
-
display: grid;
|
|
7865
|
-
grid-auto-flow: column;
|
|
7866
|
-
gap: var(--wui-space-02);
|
|
7867
|
-
`;
|
|
7868
|
-
const StyledCardIcon$1 = styled.div`
|
|
7869
|
-
display: contents;
|
|
7870
|
-
`;
|
|
7871
|
-
const StyledGatedIcon$1 = styled.div`
|
|
7872
|
-
position: absolute;
|
|
7873
|
-
right: 10px;
|
|
7874
|
-
top: 10px;
|
|
7875
|
-
z-index: 1;
|
|
7876
|
-
`;
|
|
7877
|
-
const StyledIndicatorContainer$1 = styled.div`
|
|
7878
|
-
height: ${({ $hasIcon }) => $hasIcon ? "24px" : "16px"};
|
|
7879
|
-
display: flex;
|
|
7880
|
-
align-items: center;
|
|
7881
|
-
`;
|
|
7882
|
-
const CheckboxCardDefaultLayout = ({ icon, label, description, showIndicator = true, isGated = false }) => {
|
|
7883
|
-
return /* @__PURE__ */ jsxs(StyledCardContent$1, { children: [
|
|
7884
|
-
showIndicator ? /* @__PURE__ */ jsx(StyledIndicatorContainer$1, {
|
|
7885
|
-
$hasIcon: isNotNil(icon),
|
|
7886
|
-
children: /* @__PURE__ */ jsx(CheckboxCardIndicator, { "data-testid": "wui-checkbox-card-indicator" })
|
|
7887
|
-
}) : null,
|
|
7888
|
-
isGated ? /* @__PURE__ */ jsx(StyledGatedIcon$1, {
|
|
7889
|
-
"data-testid": "wui-checkbox-gated-icon",
|
|
7890
|
-
children: /* @__PURE__ */ jsx(Icon, {
|
|
7891
|
-
colorScheme: "purple",
|
|
7892
|
-
"data-testid": "wui-icon-sparkle",
|
|
7893
|
-
type: "sparkle"
|
|
7894
|
-
})
|
|
7895
|
-
}) : null,
|
|
7896
|
-
/* @__PURE__ */ jsxs(Stack, {
|
|
7897
|
-
gap: "space-02",
|
|
7898
|
-
children: [isNotNil(icon) && /* @__PURE__ */ jsx(StyledCardIcon$1, {
|
|
7899
|
-
"data-wui-checkbox-card-icon": true,
|
|
7900
|
-
children: icon
|
|
7901
|
-
}), /* @__PURE__ */ jsxs(Stack, {
|
|
7902
|
-
gap: "space-01",
|
|
7903
|
-
style: isNotNil(icon) ? { paddingLeft: 2 } : void 0,
|
|
7904
|
-
children: [isNotNil(label) && /* @__PURE__ */ jsx(Text, {
|
|
7905
|
-
variant: "label3",
|
|
7906
|
-
children: /* @__PURE__ */ jsx("strong", { children: label })
|
|
7907
|
-
}), isNotNil(description) && /* @__PURE__ */ jsx(Text, {
|
|
7908
|
-
prominence: "secondary",
|
|
7909
|
-
variant: "body3",
|
|
7910
|
-
children: description
|
|
7911
|
-
})]
|
|
7912
|
-
})]
|
|
7913
|
-
})
|
|
7914
|
-
] });
|
|
7915
|
-
};
|
|
7916
|
-
CheckboxCardDefaultLayout.displayName = "CheckboxCardDefaultLayout_UI";
|
|
7917
|
-
//#endregion
|
|
7918
|
-
//#region src/components/CheckboxCard/CheckboxCardRoot.tsx
|
|
7919
|
-
const StyledHiddenInput = styled.input`
|
|
7920
|
-
${visuallyHiddenStyle}
|
|
7921
|
-
`;
|
|
7922
|
-
/**
|
|
7923
|
-
* `CheckboxCardRoot` renders the same card shell as `RadioCardRoot` (`StyledCard`) so
|
|
7924
|
-
* radio and checkbox cards stay visually identical — including the `--wui-radio-card-*`
|
|
7925
|
-
* custom properties consumers may override — but wires it to a hidden checkbox input
|
|
7926
|
-
* and the `CheckboxGroup` context instead.
|
|
7927
|
-
*/
|
|
7928
|
-
const CheckboxCardRoot = ({ children, disabled = false, id, isGated = false, name, onChange, value, aspectRatio = "initial", padding = "space-04", checked, ref, ...props }) => {
|
|
7929
|
-
const generatedId = useId();
|
|
7930
|
-
const computedId = isNonEmptyString(id) ? id : `wistia-ui-checkbox-card-${generatedId}`;
|
|
7931
|
-
const checkboxGroupContext = useCheckboxGroup();
|
|
7932
|
-
const contextName = checkboxGroupContext?.name;
|
|
7933
|
-
const contextOnChange = checkboxGroupContext?.onChange;
|
|
7934
|
-
const contextValue = checkboxGroupContext?.value;
|
|
7935
|
-
const checkboxName = name ?? contextName;
|
|
7936
|
-
const handleOnChange = onChange ?? contextOnChange;
|
|
7937
|
-
const isChecked = isNotUndefined(value) && isNotUndefined(contextValue) ? contextValue.includes(value) : checked;
|
|
7938
|
-
return /* @__PURE__ */ jsxs(StyledCard, {
|
|
7939
|
-
$aspectRatio: aspectRatio,
|
|
7940
|
-
$isGated: isGated,
|
|
7941
|
-
$padding: padding,
|
|
7942
|
-
htmlFor: computedId,
|
|
7943
|
-
children: [/* @__PURE__ */ jsx(StyledHiddenInput, {
|
|
7944
|
-
...props,
|
|
7945
|
-
ref,
|
|
7946
|
-
checked: isChecked,
|
|
7947
|
-
disabled,
|
|
7948
|
-
id: computedId,
|
|
7949
|
-
name: checkboxName,
|
|
7950
|
-
onChange: handleOnChange,
|
|
7951
|
-
type: "checkbox",
|
|
7952
|
-
value
|
|
7953
|
-
}), children]
|
|
7954
|
-
});
|
|
7955
|
-
};
|
|
7956
|
-
//#endregion
|
|
7957
|
-
//#region src/components/CheckboxCard/CheckboxCard.tsx
|
|
7958
|
-
/**
|
|
7959
|
-
* A `CheckboxCard` lets users select one or more options from a set of visually rich,
|
|
7960
|
-
* card-based choices. It shares its card styling with `RadioCard`, so the two can be
|
|
7961
|
-
* used side by side for single-select and multi-select questions. It supports both
|
|
7962
|
-
* standalone controlled usage and grouped usage via `CheckboxGroup`.
|
|
7963
|
-
*/
|
|
7964
|
-
const CheckboxCard = ({ icon, label, description, showIndicator, isGated, children, padding, ref, ...rootProps }) => {
|
|
7965
|
-
return /* @__PURE__ */ jsx(CheckboxCardRoot, {
|
|
7966
|
-
ref,
|
|
7967
|
-
isGated,
|
|
7968
|
-
padding: padding ?? (children != null ? "space-00" : "space-04"),
|
|
7969
|
-
...rootProps,
|
|
7970
|
-
children: children != null ? /* @__PURE__ */ jsx(CheckboxCardChildrenContainer, {
|
|
7971
|
-
"data-wui-radio-card-image": "cover",
|
|
7972
|
-
children
|
|
7973
|
-
}) : /* @__PURE__ */ jsx(CheckboxCardDefaultLayout, {
|
|
7974
|
-
description,
|
|
7975
|
-
icon,
|
|
7976
|
-
isGated,
|
|
7977
|
-
label,
|
|
7978
|
-
showIndicator
|
|
7979
|
-
})
|
|
7980
|
-
});
|
|
7981
|
-
};
|
|
7982
|
-
//#endregion
|
|
7983
7625
|
//#region src/components/ClickRegion/ClickRegion.tsx
|
|
7984
7626
|
const isClickableElement = (element) => {
|
|
7985
7627
|
if (!element) return false;
|
|
@@ -13095,6 +12737,42 @@ const FormField = ({ children, description, error, id, label, labelPosition, nam
|
|
|
13095
12737
|
};
|
|
13096
12738
|
FormField.displayName = "FormField_UI";
|
|
13097
12739
|
//#endregion
|
|
12740
|
+
//#region src/components/FormGroup/RadioGroup.tsx
|
|
12741
|
+
const RadioGroupContext = createContext(null);
|
|
12742
|
+
/**
|
|
12743
|
+
* Connects Radio components with their parent RadioGroup; provides access to `name` and `onChange`
|
|
12744
|
+
*/
|
|
12745
|
+
const useRadioGroup = () => {
|
|
12746
|
+
return useContext(RadioGroupContext);
|
|
12747
|
+
};
|
|
12748
|
+
/**
|
|
12749
|
+
* For grouping like form elements together. Can serve as a checkbox
|
|
12750
|
+
*/
|
|
12751
|
+
const RadioGroup = ({ children, name, onChange, value, ...props }) => {
|
|
12752
|
+
const formState = useContext(FormContext);
|
|
12753
|
+
const derivedValue = typeof formState.values[name] === "string" ? formState.values[name] : value;
|
|
12754
|
+
const context = useMemo(() => {
|
|
12755
|
+
return {
|
|
12756
|
+
name,
|
|
12757
|
+
onChange,
|
|
12758
|
+
value: derivedValue
|
|
12759
|
+
};
|
|
12760
|
+
}, [
|
|
12761
|
+
name,
|
|
12762
|
+
derivedValue,
|
|
12763
|
+
onChange
|
|
12764
|
+
]);
|
|
12765
|
+
return /* @__PURE__ */ jsx(RadioGroupContext, {
|
|
12766
|
+
value: context,
|
|
12767
|
+
children: /* @__PURE__ */ jsx(FormGroup, {
|
|
12768
|
+
...props,
|
|
12769
|
+
role: "radiogroup",
|
|
12770
|
+
children
|
|
12771
|
+
})
|
|
12772
|
+
});
|
|
12773
|
+
};
|
|
12774
|
+
RadioGroup.displayName = "RadioGroup_UI";
|
|
12775
|
+
//#endregion
|
|
13098
12776
|
//#region src/components/Grid/Grid.tsx
|
|
13099
12777
|
const DEFAULT_ELEMENT = "div";
|
|
13100
12778
|
/**
|
|
@@ -15455,6 +15133,142 @@ const RadioCardChildrenContainer = styled.div`
|
|
|
15455
15133
|
flex: 1 1 auto;
|
|
15456
15134
|
`;
|
|
15457
15135
|
//#endregion
|
|
15136
|
+
//#region src/components/RadioCard/RadioCardRoot.tsx
|
|
15137
|
+
const checkedStyles = css`
|
|
15138
|
+
--wui-radio-card-border-color: var(--wui-color-focus-ring);
|
|
15139
|
+
--wui-color-icon: var(--wui-color-icon-selected);
|
|
15140
|
+
--wui-radio-card-background-color: var(--wui-color-bg-surface-info);
|
|
15141
|
+
--wui-color-text: var(--wui-color-text-info);
|
|
15142
|
+
--wui-color-text-secondary: var(--wui-color-text-info);
|
|
15143
|
+
`;
|
|
15144
|
+
const disabledStyles = css`
|
|
15145
|
+
--wui-radio-card-border-color: var(--wui-color-border-disabled);
|
|
15146
|
+
--wui-radio-card-background-color: var(--wui-color-bg-surface-disabled);
|
|
15147
|
+
--wui-radio-card-cursor: not-allowed;
|
|
15148
|
+
--wui-color-icon: var(--wui-color-icon-disabled);
|
|
15149
|
+
--wui-color-text: var(--wui-color-text-disabled);
|
|
15150
|
+
--wui-color-text-secondary: var(--wui-color-text-disabled);
|
|
15151
|
+
`;
|
|
15152
|
+
const focusStyles = css`
|
|
15153
|
+
outline: 2px solid var(--wui-color-focus-ring);
|
|
15154
|
+
`;
|
|
15155
|
+
const imageCoverStyles = css`
|
|
15156
|
+
--wui-radio-card-image-inset: 0px;
|
|
15157
|
+
--wui-radio-card-border-width: 0px;
|
|
15158
|
+
--wui-inset-shadow-width: 1px;
|
|
15159
|
+
--wui-radio-card-border-color: rgb(0 0 0 / 25%);
|
|
15160
|
+
|
|
15161
|
+
overflow: hidden;
|
|
15162
|
+
|
|
15163
|
+
&:has(input:checked) {
|
|
15164
|
+
--wui-radio-card-border-color: var(--wui-color-focus-ring);
|
|
15165
|
+
--wui-radio-card-image-inset: 2px;
|
|
15166
|
+
--wui-inset-shadow-width: 2px;
|
|
15167
|
+
}
|
|
15168
|
+
|
|
15169
|
+
&:hover:not(:has(input:disabled, input:checked)) {
|
|
15170
|
+
--wui-radio-card-border-color: rgb(0 0 0 / 50%);
|
|
15171
|
+
}
|
|
15172
|
+
|
|
15173
|
+
&::after {
|
|
15174
|
+
content: '';
|
|
15175
|
+
position: absolute;
|
|
15176
|
+
top: 0;
|
|
15177
|
+
width: 100%;
|
|
15178
|
+
height: 100%;
|
|
15179
|
+
border-radius: var(--wui-radio-card-border-radius);
|
|
15180
|
+
box-shadow:
|
|
15181
|
+
inset 0 0 0 var(--wui-inset-shadow-width) var(--wui-radio-card-border-color),
|
|
15182
|
+
inset 0 0 0 calc(var(--wui-radio-card-image-inset) * 2) var(--wui-radio-card-background-color);
|
|
15183
|
+
transition: all var(--wui-motion-duration-02) var(--wui-motion-ease);
|
|
15184
|
+
}
|
|
15185
|
+
`;
|
|
15186
|
+
const StyledCard = styled.label`
|
|
15187
|
+
--wui-radio-card-border-color: var(--wui-color-border-secondary);
|
|
15188
|
+
--wui-radio-card-background-color: var(--wui-color-bg-surface);
|
|
15189
|
+
--wui-radio-card-cursor: pointer;
|
|
15190
|
+
--wui-radio-card-border-width: 1px;
|
|
15191
|
+
--wui-radio-card-border-radius: var(--wui-border-radius-02);
|
|
15192
|
+
|
|
15193
|
+
position: relative;
|
|
15194
|
+
display: inline-flex;
|
|
15195
|
+
padding: ${({ $padding }) => `var(--wui-${$padding})`};
|
|
15196
|
+
aspect-ratio: ${({ $aspectRatio }) => $aspectRatio};
|
|
15197
|
+
border: var(--wui-radio-card-border-width) solid var(--wui-radio-card-border-color);
|
|
15198
|
+
border-radius: var(--wui-radio-card-border-radius);
|
|
15199
|
+
background-color: var(--wui-radio-card-background-color);
|
|
15200
|
+
cursor: var(--wui-radio-card-cursor);
|
|
15201
|
+
overflow: hidden;
|
|
15202
|
+
transition: all var(--wui-motion-duration-03) var(--wui-motion-ease);
|
|
15203
|
+
|
|
15204
|
+
svg {
|
|
15205
|
+
transition: all var(--wui-motion-duration-03) var(--wui-motion-ease);
|
|
15206
|
+
}
|
|
15207
|
+
|
|
15208
|
+
&:hover {
|
|
15209
|
+
--wui-radio-card-border-color: var(--wui-color-border-secondary-hover);
|
|
15210
|
+
}
|
|
15211
|
+
|
|
15212
|
+
&:active {
|
|
15213
|
+
--wui-radio-card-border-color: var(--wui-color-border-secondary-active);
|
|
15214
|
+
}
|
|
15215
|
+
|
|
15216
|
+
&:has(input:checked) {
|
|
15217
|
+
${({ $isGated }) => $isGated ? getColorScheme("purple") : checkedStyles}
|
|
15218
|
+
}
|
|
15219
|
+
|
|
15220
|
+
&:has(input:disabled) {
|
|
15221
|
+
${disabledStyles}
|
|
15222
|
+
}
|
|
15223
|
+
|
|
15224
|
+
&:has(input:focus-visible) {
|
|
15225
|
+
${focusStyles}
|
|
15226
|
+
}
|
|
15227
|
+
|
|
15228
|
+
&:has([data-wui-radio-card-image]) {
|
|
15229
|
+
&:has(input:disabled) {
|
|
15230
|
+
& [data-wui-radio-card-image] {
|
|
15231
|
+
filter: grayscale(100%);
|
|
15232
|
+
}
|
|
15233
|
+
}
|
|
15234
|
+
|
|
15235
|
+
&:has([data-wui-radio-card-image='cover']) {
|
|
15236
|
+
${imageCoverStyles}
|
|
15237
|
+
}
|
|
15238
|
+
}
|
|
15239
|
+
`;
|
|
15240
|
+
const StyledHiddenInput = styled.input`
|
|
15241
|
+
${visuallyHiddenStyle}
|
|
15242
|
+
`;
|
|
15243
|
+
const RadioCardRoot = ({ children, disabled = false, id, isGated = false, name, onChange, value, aspectRatio = "initial", padding = "space-04", checked, ref, ...props }) => {
|
|
15244
|
+
const generatedId = useId();
|
|
15245
|
+
const computedId = isNonEmptyString(id) ? id : `wistia-ui-radio-${generatedId}`;
|
|
15246
|
+
const radioGroupContext = useRadioGroup();
|
|
15247
|
+
const contextName = radioGroupContext?.name;
|
|
15248
|
+
const contextOnChange = radioGroupContext?.onChange;
|
|
15249
|
+
const contextValue = radioGroupContext?.value;
|
|
15250
|
+
const radioName = name ?? contextName;
|
|
15251
|
+
const handleOnChange = onChange ?? contextOnChange;
|
|
15252
|
+
const isChecked = isNotUndefined(value) && isNotUndefined(contextValue) ? contextValue === value : checked;
|
|
15253
|
+
return /* @__PURE__ */ jsxs(StyledCard, {
|
|
15254
|
+
$aspectRatio: aspectRatio,
|
|
15255
|
+
$isGated: isGated,
|
|
15256
|
+
$padding: padding,
|
|
15257
|
+
htmlFor: computedId,
|
|
15258
|
+
children: [/* @__PURE__ */ jsx(StyledHiddenInput, {
|
|
15259
|
+
...props,
|
|
15260
|
+
ref,
|
|
15261
|
+
checked: isChecked,
|
|
15262
|
+
disabled,
|
|
15263
|
+
id: computedId,
|
|
15264
|
+
name: radioName,
|
|
15265
|
+
onChange: handleOnChange,
|
|
15266
|
+
type: "radio",
|
|
15267
|
+
value
|
|
15268
|
+
}), children]
|
|
15269
|
+
});
|
|
15270
|
+
};
|
|
15271
|
+
//#endregion
|
|
15458
15272
|
//#region src/components/RadioCard/RadioCardIndicator.tsx
|
|
15459
15273
|
const RadioCardIndicator = styled.div`
|
|
15460
15274
|
--wui-radio-card-indicator-size: 14px;
|
|
@@ -17228,6 +17042,6 @@ const WistiaLogo = ({ description, height = 100, hoverColor, href, iconOnly = fa
|
|
|
17228
17042
|
};
|
|
17229
17043
|
WistiaLogo.displayName = "WistiaLogo_UI";
|
|
17230
17044
|
//#endregion
|
|
17231
|
-
export { ActionButton, Avatar, Badge, Banner, Box, Breadcrumb, Breadcrumbs, Button, ButtonGroup, Card, Center, Checkbox,
|
|
17045
|
+
export { ActionButton, Avatar, Badge, Banner, Box, Breadcrumb, Breadcrumbs, Button, ButtonGroup, Card, Center, Checkbox, CheckboxGroup, CheckboxMenuItem, ClickRegion, Collapsible, CollapsibleContent, CollapsibleTrigger, CollapsibleTriggerIcon, ColorGrid, ColorGridOption, ColorList, ColorListGroup, ColorListOption, ColorPicker, ColorPickerPopoverContent, ColorPickerSection, ColorPickerTrigger, ColorSchemeWrapper, Combobox, ComboboxOption, ContextMenu, ContrastControls, ContrastEnforcerSwitch, ContrastIndicator, ContrastPreview, CustomizableThemeWrapper, DOCUMENT_COLOR_MODE_ATTRIBUTE, DataCard, DataCardHoverArrow, DataCardTrend, DataCards, DataList, DataListItem, DataListItemLabel, DataListItemValue, DatePicker, Dimmer, Divider, EditableHeading, EditableText, EditableTextCancelButton, EditableTextContext, EditableTextDisplay, EditableTextInput, EditableTextLabel, EditableTextRoot, EditableTextSubmitButton, EditableTextTrigger, Ellipsis, FeatureCard, FeatureCardImage, FileAmountLimitValidator, FileSizeValidator, FileTypeValidator, FilterMenu, FilterMenuItem, Form, FormErrorSummary, FormField, FormGroup, Grid, Heading, HexColorInput, HueSlider, Icon, IconButton, Image, ImageDimensionsValidator, Input, InputClickToCopy, InputDuration, InputPassword, KeyboardShortcut, Label, Link, List, ListItem, Mark, Markdown, Menu, MenuItem, MenuItemDescription, MenuItemLabel, MenuLabel, MenuRadioGroup, Meter, Modal, ModalCallout, ModalCallouts, PersistentFileAmountLimitValidator, Popover, PopoverAnchor, PopoverArrow, PopoverClose, PopoverCloseButton, PopoverContent, PopoverPortal, PopoverRoot, PopoverTrigger, PreviewCard, ProgressBar, Radio, RadioCard, RadioCardImage, RadioGroup, RadioMenuItem, SaturationAndValuePicker, ScreenReaderOnly, ScrollArea, SegmentedControl, SegmentedControlItem, Select, SelectOption, SelectOptionGroup, Sidebar, SidebarButton, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupLabel, SidebarHeader, SidebarSearchInput, SidebarTitle, Slider, SplitButton, Stack, SubMenu, Switch, Table, TableBody, TableCell, TableFoot, TableHead, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Tag, Text, Thumbnail, ThumbnailBadge, ThumbnailCollage, Tooltip, UIProvider, ValueNameOrHexCode, ValueSwatch, WistiaLogo, buildTimeDuration, calculateContrast, coerceToBoolean, colorModeOptions, colorSchemeOptions, copyToClipboard, dateOnlyISOString, dateOnlyString, dateOnlyStringForSentence, dateOnlyStringNumeric, dateTime, dateTimeRounded, dateTimeString, dateTimeStringForSentence, dateTimeToDate, dateTimeToISO, dateToDateTime, dateUTCOffset, dayOfWeekString, documentColorModeOptions, getBackgroundGradient, getDocumentColorMode, getSemiRandomBackgroundGradient, iconSizeMap, isKeyboardKey, isUrl, mediaDurationString, mergeRefs, millisecondsToDurationISOString, monthDayStringNumeric, mq, parseDateString, sessionDurationString, setDocumentColorMode, stripExtension, timeAgoString, timeOnlyString, useActiveMq, useAriaLive, useBoolean, useClipboard, useDocumentColorMode, useElementObserver, useFilePicker, useFocusTrap, useForceUpdate, useFormState, useImperativeFilePicker, useIsHovered, useKey, useKeyPress, useLocalStorage, useLockBodyScroll, useMq, useOnClickOutside, usePreviousValue, useToast, useWindowSize, validateWithYup };
|
|
17232
17046
|
|
|
17233
17047
|
//# sourceMappingURL=index.js.map
|