@yahoo/uds 3.59.0-beta.1 → 3.59.0-beta.2
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/cli/bin/uds-darwin-arm64-baseline +0 -0
- package/cli/bin/uds-darwin-x64 +0 -0
- package/cli/bin/uds-linux-arm64 +0 -0
- package/cli/bin/uds-linux-x64-baseline +0 -0
- package/dist/components/Box.d.ts +2 -2
- package/dist/components/Box.d.ts.map +1 -1
- package/dist/components/Divider/Divider.d.cts +2 -2
- package/dist/components/Divider/Divider.d.ts +2 -2
- package/dist/components/Divider/DividerCore.d.cts +2 -2
- package/dist/components/Divider/DividerCore.d.ts +2 -2
- package/dist/components/Divider/DividerInternal.d.cts +2 -2
- package/dist/components/Divider/DividerInternal.d.ts +2 -2
- package/dist/components/FormLabel.d.ts +2 -2
- package/dist/components/HStack.d.ts +2 -2
- package/dist/components/Icon.d.ts +2 -2
- package/dist/components/Link.d.ts +2 -2
- package/dist/components/Text.d.cts +5 -5
- package/dist/components/Text.d.cts.map +1 -1
- package/dist/components/Text.d.ts +8 -8
- package/dist/components/Text.d.ts.map +1 -1
- package/dist/components/VStack.d.ts +2 -2
- package/dist/components/VStack.d.ts.map +1 -1
- package/dist/components/client/AnimateHeightChange.d.cts +2 -2
- package/dist/components/client/AnimateHeightChange.d.ts +2 -2
- package/dist/components/client/Avatar/Avatar.d.cts +2 -2
- package/dist/components/client/Avatar/Avatar.d.cts.map +1 -1
- package/dist/components/client/Avatar/Avatar.d.ts +2 -2
- package/dist/components/client/Avatar/AvatarIcon.d.cts +2 -2
- package/dist/components/client/Avatar/AvatarIcon.d.cts.map +1 -1
- package/dist/components/client/Avatar/AvatarIcon.d.ts +2 -2
- package/dist/components/client/Avatar/AvatarImage.d.cts +2 -2
- package/dist/components/client/Avatar/AvatarImage.d.ts +2 -2
- package/dist/components/client/Avatar/AvatarText.d.cts +2 -2
- package/dist/components/client/Avatar/AvatarText.d.ts +2 -2
- package/dist/components/client/IconButton.d.cts +2 -2
- package/dist/components/client/IconButton.d.ts +2 -2
- package/dist/components/client/IconButton.d.ts.map +1 -1
- package/dist/components/client/Input/Input.d.cts +2 -2
- package/dist/components/client/Input/Input.d.ts +2 -2
- package/dist/components/client/Input/InputHelpText.d.cts +2 -2
- package/dist/components/client/Input/InputHelpText.d.cts.map +1 -1
- package/dist/components/client/Input/InputHelpText.d.ts +2 -2
- package/dist/components/client/Input/InputHelpTextInternal.d.cts +4 -4
- package/dist/components/client/Input/InputHelpTextInternal.d.cts.map +1 -1
- package/dist/components/client/Input/InputHelpTextInternal.d.ts +4 -4
- package/dist/components/client/Menu/Menu.Content.d.cts +2 -2
- package/dist/components/client/Menu/Menu.Content.d.ts +2 -2
- package/dist/components/client/Menu/Menu.Divider.d.cts +2 -2
- package/dist/components/client/Menu/Menu.Divider.d.ts +2 -2
- package/dist/components/client/Menu/Menu.Item.d.cts +2 -2
- package/dist/components/client/Menu/Menu.ItemBase.d.cts +2 -2
- package/dist/components/client/Menu/Menu.ItemBase.d.ts +2 -2
- package/dist/components/client/Menu/Menu.ItemCheckbox.d.cts +2 -2
- package/dist/components/client/Menu/Menu.ItemCheckbox.d.ts +2 -2
- package/dist/components/client/Menu/Menu.Provider.d.cts +2 -2
- package/dist/components/client/Menu/Menu.Provider.d.ts +2 -2
- package/dist/components/client/Menu/Menu.Trigger.d.cts +2 -2
- package/dist/components/client/Menu/Menu.Trigger.d.ts +2 -2
- package/dist/components/client/Pressable.d.cts +2 -2
- package/dist/components/client/Pressable.d.ts +2 -2
- package/dist/components/client/Pressable.d.ts.map +1 -1
- package/dist/components/client/Radio/RadioGroupStore.d.ts +2 -2
- package/dist/components/client/SpringMotionConfig.d.cts +3 -3
- package/dist/components/client/SpringMotionConfig.d.ts +3 -3
- package/dist/components/client/SpringMotionConfig.d.ts.map +1 -1
- package/dist/components/experimental/Spinner.d.cts +2 -2
- package/dist/components/experimental/Spinner.d.cts.map +1 -1
- package/dist/components/experimental/Spinner.d.ts +2 -2
- package/dist/components/experimental/Table.d.cts +2 -2
- package/dist/components/experimental/Table.d.ts +2 -2
- package/dist/components/experimental/client/Accordion.d.cts +2 -2
- package/dist/components/experimental/client/Accordion.d.cts.map +1 -1
- package/dist/components/experimental/client/Accordion.d.ts +2 -2
- package/dist/components/experimental/client/AvoidMotionLibraryProvider.d.cts +2 -2
- package/dist/components/experimental/client/AvoidMotionLibraryProvider.d.ts +2 -2
- package/dist/components/experimental/client/Modal.d.cts +3 -3
- package/dist/components/experimental/client/Modal.d.cts.map +1 -1
- package/dist/components/experimental/client/Modal.d.ts +3 -3
- package/dist/components/experimental/client/Popover.d.cts +3 -3
- package/dist/components/experimental/client/Popover.d.cts.map +1 -1
- package/dist/components/experimental/client/Popover.d.ts +3 -3
- package/dist/components/experimental/client/Tabs.d.cts +3 -3
- package/dist/components/experimental/client/Tabs.d.ts +6 -6
- package/dist/components/experimental/client/Toast.d.cts +2 -2
- package/dist/components/experimental/client/Toast.d.ts +2 -2
- package/dist/providers/ColorModeProvider.d.cts +4 -4
- package/dist/providers/ColorModeProvider.d.cts.map +1 -1
- package/dist/providers/ColorModeProvider.d.ts +4 -4
- package/dist/providers/ColorModeProvider.d.ts.map +1 -1
- package/dist/providers/ScaleModeProvider.d.cts +4 -4
- package/dist/providers/ScaleModeProvider.d.cts.map +1 -1
- package/dist/providers/ScaleModeProvider.d.ts +4 -4
- package/dist/providers/ScaleModeProvider.d.ts.map +1 -1
- package/dist/providers/ThemeProvider.d.cts +2 -2
- package/dist/providers/ThemeProvider.d.cts.map +1 -1
- package/dist/providers/ThemeProvider.d.ts +2 -2
- package/dist/styles/styler.d.cts +33 -33
- package/dist/styles/styler.d.ts +33 -33
- package/dist/styles/stylerTypes.d.ts.map +1 -1
- package/dist/tailwind/tailwind.config.d.ts +3 -3
- package/dist/tailwind/tailwindPlugin.d.ts +3 -3
- package/dist/tailwind/utils/getMotionStyles.d.cts +1 -1
- package/dist/tailwind/utils/getMotionStyles.d.ts +1 -1
- package/dist/tokens/automation/utils/getConfigVariantProperties.d.cts +2 -2
- package/dist/tokens/automation/utils/getConfigVariantProperties.d.cts.map +1 -1
- package/dist/tokens/automation/utils/getConfigVariantProperties.d.ts +2 -2
- package/dist/tokens/automation/utils/getConfigVariantProperties.d.ts.map +1 -1
- package/dist/tokens/types.d.cts.map +1 -1
- package/dist/tokens/types.d.ts.map +1 -1
- package/dist/utils/intersperse.d.cts +2 -2
- package/dist/utils/intersperse.d.ts +2 -2
- package/package.json +1 -3
- package/cli/FlattenButtonVariant.mock.tsx +0 -17
- package/src/components/Box.tsx +0 -181
- package/src/components/Divider/Divider.tsx +0 -44
- package/src/components/Divider/DividerCore.tsx +0 -101
- package/src/components/Divider/DividerInternal.tsx +0 -56
- package/src/components/Divider/index.ts +0 -1
- package/src/components/FormLabel.tsx +0 -66
- package/src/components/HStack.tsx +0 -53
- package/src/components/Icon.tsx +0 -82
- package/src/components/IconSlot.tsx +0 -82
- package/src/components/Image.tsx +0 -162
- package/src/components/Link.tsx +0 -134
- package/src/components/Text.tsx +0 -272
- package/src/components/VStack.tsx +0 -53
- package/src/components/client/AnimateHeightChange.tsx +0 -50
- package/src/components/client/Avatar/Avatar.tsx +0 -31
- package/src/components/client/Avatar/AvatarIcon.tsx +0 -103
- package/src/components/client/Avatar/AvatarImage.tsx +0 -147
- package/src/components/client/Avatar/AvatarText.tsx +0 -88
- package/src/components/client/Avatar/index.ts +0 -4
- package/src/components/client/Avatar/utils.ts +0 -105
- package/src/components/client/Badge.tsx +0 -133
- package/src/components/client/Button.tsx +0 -312
- package/src/components/client/Checkbox.tsx +0 -377
- package/src/components/client/Chip/Chip.tsx +0 -81
- package/src/components/client/Chip/ChipBase.tsx +0 -151
- package/src/components/client/Chip/ChipButton.tsx +0 -54
- package/src/components/client/Chip/ChipDismissible.tsx +0 -90
- package/src/components/client/Chip/ChipLink.tsx +0 -60
- package/src/components/client/Chip/ChipToggle.tsx +0 -79
- package/src/components/client/Chip/index.ts +0 -5
- package/src/components/client/IconButton.tsx +0 -198
- package/src/components/client/Input/Input.tsx +0 -323
- package/src/components/client/Input/InputHelpText.tsx +0 -52
- package/src/components/client/Input/InputHelpTextInternal.tsx +0 -81
- package/src/components/client/Input/index.ts +0 -2
- package/src/components/client/Menu/Menu.Content.tsx +0 -391
- package/src/components/client/Menu/Menu.Divider.tsx +0 -102
- package/src/components/client/Menu/Menu.Item.tsx +0 -114
- package/src/components/client/Menu/Menu.ItemBase.tsx +0 -265
- package/src/components/client/Menu/Menu.ItemCheckbox.tsx +0 -197
- package/src/components/client/Menu/Menu.Provider.tsx +0 -154
- package/src/components/client/Menu/Menu.Trigger.tsx +0 -119
- package/src/components/client/Menu/Menu.index.tsx +0 -9
- package/src/components/client/Menu/Menu.tsx +0 -2
- package/src/components/client/Menu/index.ts +0 -7
- package/src/components/client/Menu/utils/transformAriakitPlacement.ts +0 -66
- package/src/components/client/Pressable.tsx +0 -194
- package/src/components/client/Radio/Radio.tsx +0 -351
- package/src/components/client/Radio/RadioGroupProvider.tsx +0 -122
- package/src/components/client/Radio/RadioGroupStore.tsx +0 -56
- package/src/components/client/Radio/index.ts +0 -2
- package/src/components/client/Radio/useRadioGroup.ts +0 -149
- package/src/components/client/SpringMotionConfig.tsx +0 -151
- package/src/components/client/Switch.tsx +0 -377
- package/src/components/client/index.ts +0 -30
- package/src/components/client/motionFeatures/domAnimation.ts +0 -2
- package/src/components/client/motionFeatures/domMax.ts +0 -2
- package/src/components/experimental/Spinner.tsx +0 -30
- package/src/components/experimental/Table.mocks.tsx +0 -38
- package/src/components/experimental/Table.tsx +0 -239
- package/src/components/experimental/client/Accordion.tsx +0 -77
- package/src/components/experimental/client/AvoidMotionLibraryProvider.tsx +0 -10
- package/src/components/experimental/client/Modal.tsx +0 -68
- package/src/components/experimental/client/Popover.tsx +0 -63
- package/src/components/experimental/client/SwitchV2.tsx +0 -343
- package/src/components/experimental/client/Tabs.tsx +0 -106
- package/src/components/experimental/client/Toast.tsx +0 -186
- package/src/components/experimental/client/index.ts +0 -15
- package/src/components/experimental/index.ts +0 -48
- package/src/components/index.ts +0 -41
- package/src/defaultTokensConfig.ts +0 -31
- package/src/fixtures/index.ts +0 -638
- package/src/fixtures/macros/typesToConstants.ts +0 -42
- package/src/fixtures/utils/getScaleModeRamp.ts +0 -48
- package/src/fixtures/utils/getTailwindAsUdsColors.ts +0 -115
- package/src/flags.ts +0 -45
- package/src/hooks/useForkRef.ts +0 -34
- package/src/hooks/useNestedBorderRadius.ts +0 -138
- package/src/hooks/useRtl.ts +0 -64
- package/src/index.ts +0 -4
- package/src/providers/ColorModeProvider.tsx +0 -21
- package/src/providers/ScaleModeProvider.tsx +0 -29
- package/src/providers/ThemeProvider.tsx +0 -26
- package/src/styles/styler.ts +0 -194
- package/src/styles/stylerTypes.ts +0 -81
- package/src/styles/toast.css +0 -0
- package/src/styles/variants.ts +0 -1351
- package/src/tailwind/base/addColorModeVars.ts +0 -23
- package/src/tailwind/base/addColorModeVarsV2.ts +0 -57
- package/src/tailwind/base/addFontFaceDeclarations.ts +0 -13
- package/src/tailwind/base/addFontVars.ts +0 -9
- package/src/tailwind/base/addMotionVars.ts +0 -9
- package/src/tailwind/base/addScaleModeVars.ts +0 -33
- package/src/tailwind/base/types.ts +0 -8
- package/src/tailwind/components/getButtonStyles.ts +0 -240
- package/src/tailwind/components/getFocusRingStyles.ts +0 -32
- package/src/tailwind/components/getGroupedTextStyles.ts +0 -29
- package/src/tailwind/components/getHitTargetStyles.ts +0 -23
- package/src/tailwind/components/getIconButtonStyles.ts +0 -49
- package/src/tailwind/components/getIconStyles.ts +0 -13
- package/src/tailwind/components/getInputStyles.ts +0 -20
- package/src/tailwind/components/getResponsiveTextStyles.ts +0 -161
- package/src/tailwind/components/types.ts +0 -14
- package/src/tailwind/components/utils.ts +0 -73
- package/src/tailwind/defaultTailwindThemeAsUdsConfig.ts +0 -78
- package/src/tailwind/postcss.config.ts +0 -6
- package/src/tailwind/purger/index.ts +0 -1
- package/src/tailwind/tailwind.config.ts +0 -50
- package/src/tailwind/tailwind.d.ts +0 -5
- package/src/tailwind/tailwindPlugin.ts +0 -724
- package/src/tailwind/theme/getFontFamilyTheme.ts +0 -28
- package/src/tailwind/tsMorph.ts +0 -1
- package/src/tailwind/uds.css +0 -3
- package/src/tailwind/utils/addFontsPlugin.ts +0 -17
- package/src/tailwind/utils/getColorModeStyles.ts +0 -21
- package/src/tailwind/utils/getFontFaceDeclarations.ts +0 -12
- package/src/tailwind/utils/getFontStyles.ts +0 -38
- package/src/tailwind/utils/getMotionStyles.ts +0 -35
- package/src/tailwind/utils/getScaleModeStyles.ts +0 -23
- package/src/tailwind/utils/getShadowPresetValues.ts +0 -133
- package/src/tailwind/utils/getShadowStyles.ts +0 -26
- package/src/tailwind/utils/getShadowVars.ts +0 -40
- package/src/tailwind/utils/index.ts +0 -9
- package/src/tokens/automation/configs/avatar.ts +0 -297
- package/src/tokens/automation/configs/badge.ts +0 -306
- package/src/tokens/automation/configs/checkbox.ts +0 -226
- package/src/tokens/automation/configs/chip.ts +0 -521
- package/src/tokens/automation/configs/divider.ts +0 -112
- package/src/tokens/automation/configs/index.ts +0 -10
- package/src/tokens/automation/configs/input.ts +0 -496
- package/src/tokens/automation/configs/link.ts +0 -183
- package/src/tokens/automation/configs/menu.ts +0 -344
- package/src/tokens/automation/configs/radio.ts +0 -225
- package/src/tokens/automation/configs/switch.ts +0 -323
- package/src/tokens/automation/index.ts +0 -5
- package/src/tokens/automation/mapTextVariantFixtureToValue.ts +0 -8
- package/src/tokens/automation/properties.ts +0 -433
- package/src/tokens/automation/types/ComponentConfig.ts +0 -116
- package/src/tokens/automation/types/ComponentDB.ts +0 -1
- package/src/tokens/automation/types/ComponentStyles.ts +0 -47
- package/src/tokens/automation/types/index.ts +0 -2
- package/src/tokens/automation/utils/cartesianProduct.ts +0 -13
- package/src/tokens/automation/utils/coalesceConfigVariant.ts +0 -49
- package/src/tokens/automation/utils/defaults.ts +0 -29
- package/src/tokens/automation/utils/generateKeyFromFlatConfigPath.ts +0 -15
- package/src/tokens/automation/utils/generateSchemaKey.ts +0 -29
- package/src/tokens/automation/utils/getConfigComponentVariant.ts +0 -28
- package/src/tokens/automation/utils/getConfigVariantComponentStatesMatrix.ts +0 -40
- package/src/tokens/automation/utils/getConfigVariantProperties.ts +0 -32
- package/src/tokens/automation/utils/getConfigVariantPseudoStates.ts +0 -70
- package/src/tokens/automation/utils/getConfigVariants.ts +0 -73
- package/src/tokens/automation/utils/index.ts +0 -939
- package/src/tokens/automation/utils/mapColorFixtureToValue.ts +0 -34
- package/src/tokens/automation/utils/subcomponents.ts +0 -13
- package/src/tokens/automation/utils/variableData.ts +0 -79
- package/src/tokens/automation/utils/variantConfigGuards.ts +0 -17
- package/src/tokens/configs/borderRadius.ts +0 -23
- package/src/tokens/configs/borderWidth.ts +0 -17
- package/src/tokens/configs/button.ts +0 -888
- package/src/tokens/configs/colorMode.ts +0 -14
- package/src/tokens/configs/font.ts +0 -9
- package/src/tokens/configs/iconButton.ts +0 -28
- package/src/tokens/configs/motion.ts +0 -135
- package/src/tokens/configs/palette.ts +0 -124
- package/src/tokens/configs/scaleMode.ts +0 -28
- package/src/tokens/configs/shadow.ts +0 -286
- package/src/tokens/configs/sizes.ts +0 -23
- package/src/tokens/configs/spectrum.ts +0 -729
- package/src/tokens/configs/typography.ts +0 -417
- package/src/tokens/configs/yosConfig.ts +0 -7651
- package/src/tokens/consts/buttonMotionTokens.ts +0 -99
- package/src/tokens/consts/cssTokens.ts +0 -110
- package/src/tokens/consts/defaultModes.ts +0 -15
- package/src/tokens/consts/fontDeclarationsMap.ts +0 -509
- package/src/tokens/index.ts +0 -15
- package/src/tokens/parseButtonVariants.ts +0 -59
- package/src/tokens/parseTokens.ts +0 -122
- package/src/tokens/types.ts +0 -1882
- package/src/tokens/utils/entries.ts +0 -14
- package/src/tokens/utils/fromEntries.ts +0 -11
- package/src/tokens/utils/mapValues.ts +0 -15
- package/src/types.ts +0 -2
- package/src/utils/assertUnreachable.ts +0 -6
- package/src/utils/composeRefs.ts +0 -23
- package/src/utils/createSlot.tsx +0 -131
- package/src/utils/entries.ts +0 -6
- package/src/utils/falsyToString.ts +0 -3
- package/src/utils/getMotionVar.ts +0 -18
- package/src/utils/intersperse.ts +0 -45
- package/src/utils/mapValues.ts +0 -15
- package/src/utils/mergeSlotProps.ts +0 -70
|
@@ -1,239 +0,0 @@
|
|
|
1
|
-
/* eslint-disable react/no-multi-comp */
|
|
2
|
-
import type { UniversalTextProps } from '@yahoo/uds/tokens';
|
|
3
|
-
import type {
|
|
4
|
-
ForwardedRef,
|
|
5
|
-
HTMLAttributes,
|
|
6
|
-
PropsWithChildren,
|
|
7
|
-
TableHTMLAttributes,
|
|
8
|
-
TdHTMLAttributes,
|
|
9
|
-
} from 'react';
|
|
10
|
-
import React, { forwardRef, isValidElement } from 'react';
|
|
11
|
-
|
|
12
|
-
import { getStyles } from '../../styles/styler';
|
|
13
|
-
import type { BoxProps, TextProps } from '..';
|
|
14
|
-
import { Box, Text } from '..';
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* TableColumn
|
|
18
|
-
* A TableColumn is a definition of a column in a table.
|
|
19
|
-
*/
|
|
20
|
-
type TableColumn<T> = {
|
|
21
|
-
title?: string;
|
|
22
|
-
dataIndex: keyof T;
|
|
23
|
-
render?: (value: T[keyof T], record: T, index: number) => React.ReactNode;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
type TableRootProps = TableHTMLAttributes<HTMLTableElement> &
|
|
27
|
-
BoxProps & {
|
|
28
|
-
/** Sets whether an element is treated as a block or inline box and the
|
|
29
|
-
* layout used for its children, such as flow layout, grid or flex.
|
|
30
|
-
* @default "table"
|
|
31
|
-
*/
|
|
32
|
-
display?: BoxProps['display'];
|
|
33
|
-
};
|
|
34
|
-
const TableRoot = forwardRef(function TableRoot(
|
|
35
|
-
{
|
|
36
|
-
children,
|
|
37
|
-
className,
|
|
38
|
-
display = 'table',
|
|
39
|
-
overflow = 'hidden',
|
|
40
|
-
borderColor = 'muted',
|
|
41
|
-
borderRadius = 'md',
|
|
42
|
-
...props
|
|
43
|
-
}: PropsWithChildren<TableRootProps>,
|
|
44
|
-
ref: ForwardedRef<HTMLTableElement>,
|
|
45
|
-
) {
|
|
46
|
-
return (
|
|
47
|
-
<Box
|
|
48
|
-
asChild
|
|
49
|
-
borderColor={borderColor}
|
|
50
|
-
borderRadius={borderRadius}
|
|
51
|
-
className={className}
|
|
52
|
-
overflow={overflow}
|
|
53
|
-
display={display}
|
|
54
|
-
{...props}
|
|
55
|
-
>
|
|
56
|
-
<table ref={ref}>{children}</table>
|
|
57
|
-
</Box>
|
|
58
|
-
);
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
TableRoot.displayName = 'TableRoot';
|
|
62
|
-
|
|
63
|
-
/* -------------------------------------------------------------------------- */
|
|
64
|
-
/* Table.Row */
|
|
65
|
-
/* -------------------------------------------------------------------------- */
|
|
66
|
-
type TableRowProps = HTMLAttributes<HTMLTableRowElement> & BoxProps;
|
|
67
|
-
const TableRow = forwardRef(function TableRow(
|
|
68
|
-
{ children, display = 'table-row', ...props }: PropsWithChildren<TableRowProps>,
|
|
69
|
-
ref: ForwardedRef<HTMLTableRowElement>,
|
|
70
|
-
) {
|
|
71
|
-
return (
|
|
72
|
-
<Box asChild display={display} {...props}>
|
|
73
|
-
<tr ref={ref}>{children}</tr>
|
|
74
|
-
</Box>
|
|
75
|
-
);
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
TableRow.displayName = 'TableRow';
|
|
79
|
-
|
|
80
|
-
/* -------------------------------------------------------------------------- */
|
|
81
|
-
/* Table.Header */
|
|
82
|
-
/* -------------------------------------------------------------------------- */
|
|
83
|
-
type TableHeaderProps = HTMLAttributes<HTMLTableSectionElement> & BoxProps;
|
|
84
|
-
const TableHeader = forwardRef(function TableHeader(
|
|
85
|
-
{ children, display = 'table-header-group', ...props }: PropsWithChildren<TableHeaderProps>,
|
|
86
|
-
ref: ForwardedRef<HTMLTableSectionElement>,
|
|
87
|
-
) {
|
|
88
|
-
return (
|
|
89
|
-
<Box asChild display={display} {...props}>
|
|
90
|
-
<thead ref={ref}>{children}</thead>
|
|
91
|
-
</Box>
|
|
92
|
-
);
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
TableHeader.displayName = 'TableHeader';
|
|
96
|
-
|
|
97
|
-
/* -------------------------------------------------------------------------- */
|
|
98
|
-
/* Table.Body */
|
|
99
|
-
/* -------------------------------------------------------------------------- */
|
|
100
|
-
type TableBodyProps = HTMLAttributes<HTMLTableSectionElement> & BoxProps;
|
|
101
|
-
const TableBody = forwardRef(function TableBody(
|
|
102
|
-
{ children, display = 'table-row-group', ...props }: PropsWithChildren<TableBodyProps>,
|
|
103
|
-
ref: ForwardedRef<HTMLTableSectionElement>,
|
|
104
|
-
) {
|
|
105
|
-
return (
|
|
106
|
-
<Box asChild display={display} {...props}>
|
|
107
|
-
<tbody ref={ref}>{children}</tbody>
|
|
108
|
-
</Box>
|
|
109
|
-
);
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
TableBody.displayName = 'TableBody';
|
|
113
|
-
|
|
114
|
-
/* -------------------------------------------------------------------------- */
|
|
115
|
-
/* Table.Cell */
|
|
116
|
-
/* -------------------------------------------------------------------------- */
|
|
117
|
-
type HTMLTableCellProps = Omit<
|
|
118
|
-
TdHTMLAttributes<HTMLTableCellElement>,
|
|
119
|
-
'color' | 'height' | 'width'
|
|
120
|
-
>;
|
|
121
|
-
interface TableCellProps extends Omit<UniversalTextProps, 'color'>, HTMLTableCellProps {
|
|
122
|
-
/** asHeaderCell will return a th element instead of a td element.
|
|
123
|
-
* If asHeaderCell is row, it will return a th element with scope="row"
|
|
124
|
-
* @default false
|
|
125
|
-
*/
|
|
126
|
-
asHeaderCell?: boolean | 'column' | 'row';
|
|
127
|
-
color?: TextProps['color'];
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
const TableCell = forwardRef(function TableCell(
|
|
131
|
-
{
|
|
132
|
-
// TODO: spread props here like we do in Text
|
|
133
|
-
// Or setup a macro to collect all the props into buckets
|
|
134
|
-
// @example: https://gist.github.com/jakeleboeuf/f3d871efdb74947105e8c1185fa8e82e
|
|
135
|
-
// TextProps
|
|
136
|
-
asHeaderCell,
|
|
137
|
-
className,
|
|
138
|
-
display = 'table-cell',
|
|
139
|
-
spacing = '3',
|
|
140
|
-
borderBottomColor = 'muted',
|
|
141
|
-
color = 'primary',
|
|
142
|
-
// TableCellProps
|
|
143
|
-
...props
|
|
144
|
-
}: PropsWithChildren<TableCellProps>,
|
|
145
|
-
ref: ForwardedRef<HTMLTableCellElement | HTMLTableHeaderCellElement>,
|
|
146
|
-
) {
|
|
147
|
-
const classNames = getStyles({ textAlign: 'start', className });
|
|
148
|
-
const CellComponent = asHeaderCell ? 'th' : 'td';
|
|
149
|
-
const cellScope = asHeaderCell === 'row' ? 'row' : asHeaderCell ? 'column' : undefined;
|
|
150
|
-
const textVariant: TextProps['variant'] = asHeaderCell ? 'headline1' : 'body1';
|
|
151
|
-
|
|
152
|
-
return (
|
|
153
|
-
<Text
|
|
154
|
-
asChild
|
|
155
|
-
variant={textVariant}
|
|
156
|
-
color={color}
|
|
157
|
-
display={display}
|
|
158
|
-
spacing={spacing}
|
|
159
|
-
borderBottomColor={borderBottomColor}
|
|
160
|
-
borderBottomWidth="thin"
|
|
161
|
-
className={classNames}
|
|
162
|
-
>
|
|
163
|
-
<CellComponent scope={cellScope} {...props} ref={ref} />
|
|
164
|
-
</Text>
|
|
165
|
-
);
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
TableCell.displayName = 'TableCell';
|
|
169
|
-
|
|
170
|
-
/* -------------------------------------------------------------------------- */
|
|
171
|
-
/* Assign the sub-components to the Table component */
|
|
172
|
-
/* -------------------------------------------------------------------------- */
|
|
173
|
-
Table.Root = TableRoot;
|
|
174
|
-
Table.Row = TableRow;
|
|
175
|
-
Table.Header = TableHeader;
|
|
176
|
-
Table.Body = TableBody;
|
|
177
|
-
Table.Cell = TableCell;
|
|
178
|
-
|
|
179
|
-
/* -------------------------------------------------------------------------- */
|
|
180
|
-
/* Table */
|
|
181
|
-
/* -------------------------------------------------------------------------- */
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Table component props
|
|
185
|
-
* @template T The type of data in the table.
|
|
186
|
-
*/
|
|
187
|
-
type TableProps<T> = {
|
|
188
|
-
/** An array of data for the table. Each item represents a row in the table.
|
|
189
|
-
* The keys of each item should match the `dataIndex` of the columns.
|
|
190
|
-
*/
|
|
191
|
-
data: T[];
|
|
192
|
-
/** An array of columns for the table. Each item defines a column in the table.
|
|
193
|
-
* The `dataIndex` should match the key of the data item.
|
|
194
|
-
*/
|
|
195
|
-
columns: TableColumn<T>[];
|
|
196
|
-
} & TableRootProps;
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* The Table component renders a table with the given data and columns.
|
|
200
|
-
* If you want more control over the table, or want to handle virtualization,
|
|
201
|
-
* drag-n-drop, etc, Please can use the sub-components directly and build your own!
|
|
202
|
-
*/
|
|
203
|
-
function Table<T>({ data, columns, ...props }: TableProps<T>) {
|
|
204
|
-
return (
|
|
205
|
-
<Table.Root {...props}>
|
|
206
|
-
<Table.Header>
|
|
207
|
-
<Table.Row>
|
|
208
|
-
{columns.map((column, index) => (
|
|
209
|
-
<Table.Cell key={index} asHeaderCell="column">
|
|
210
|
-
{column.title}
|
|
211
|
-
</Table.Cell>
|
|
212
|
-
))}
|
|
213
|
-
</Table.Row>
|
|
214
|
-
</Table.Header>
|
|
215
|
-
<Table.Body>
|
|
216
|
-
{data.map((record, rowIndex) => (
|
|
217
|
-
<Table.Row key={rowIndex}>
|
|
218
|
-
{columns.map((column, colIndex) => {
|
|
219
|
-
const cellData = record[column.dataIndex];
|
|
220
|
-
return (
|
|
221
|
-
<Table.Cell key={colIndex}>
|
|
222
|
-
{column.render
|
|
223
|
-
? column.render(cellData, record, rowIndex)
|
|
224
|
-
: isValidElement(cellData)
|
|
225
|
-
? cellData
|
|
226
|
-
: String(cellData)}
|
|
227
|
-
</Table.Cell>
|
|
228
|
-
);
|
|
229
|
-
})}
|
|
230
|
-
</Table.Row>
|
|
231
|
-
))}
|
|
232
|
-
</Table.Body>
|
|
233
|
-
</Table.Root>
|
|
234
|
-
);
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
Table.displayName = 'Table';
|
|
238
|
-
|
|
239
|
-
export { Table, type TableColumn, type TableProps };
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { ChevronRight } from '@yahoo/uds-icons';
|
|
2
|
-
// SpringMotionConfig is in the global App scope, so we must use `m` from `motion/react` instead of `motion` (https://motion.dev/docs/react-reduce-bundle-size#reduce-size).
|
|
3
|
-
import { AnimatePresence, m } from 'motion/react';
|
|
4
|
-
|
|
5
|
-
import { cx } from '../../../styles/styler';
|
|
6
|
-
import type { PressableProps, TextProps, VStackProps } from '../..';
|
|
7
|
-
import { Icon, Pressable, SpringMotionConfig, Text, VStack } from '../..';
|
|
8
|
-
|
|
9
|
-
interface AccordionProps extends PressableProps {
|
|
10
|
-
label: string;
|
|
11
|
-
open?: boolean;
|
|
12
|
-
onClick?: () => void;
|
|
13
|
-
_content?: VStackProps;
|
|
14
|
-
textProps?: TextProps;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function Accordion({
|
|
18
|
-
label,
|
|
19
|
-
children,
|
|
20
|
-
onClick,
|
|
21
|
-
open,
|
|
22
|
-
spacingHorizontal = '4',
|
|
23
|
-
_content,
|
|
24
|
-
className,
|
|
25
|
-
textProps,
|
|
26
|
-
...props
|
|
27
|
-
}: AccordionProps) {
|
|
28
|
-
return (
|
|
29
|
-
<SpringMotionConfig layoutVariant="smooth" layoutSpeed="3">
|
|
30
|
-
<Pressable
|
|
31
|
-
display="flex"
|
|
32
|
-
flexDirection="row"
|
|
33
|
-
alignItems="center"
|
|
34
|
-
justifyContent="space-between"
|
|
35
|
-
spacingVertical="4"
|
|
36
|
-
spacingHorizontal={spacingHorizontal}
|
|
37
|
-
borderRadius="md"
|
|
38
|
-
onClick={onClick}
|
|
39
|
-
className={cx('hover:bg-secondary/80', 'w-full', className)}
|
|
40
|
-
{...props}
|
|
41
|
-
>
|
|
42
|
-
<Text variant="title4" color="primary" {...(textProps || {})}>
|
|
43
|
-
{label}
|
|
44
|
-
</Text>
|
|
45
|
-
|
|
46
|
-
<AnimatePresence initial={false}>
|
|
47
|
-
<m.div
|
|
48
|
-
initial="collapsed"
|
|
49
|
-
animate={open ? 'open' : 'collapsed'}
|
|
50
|
-
exit="collapsed"
|
|
51
|
-
variants={{ open: { rotate: 90 }, collapsed: { rotate: 0 } }}
|
|
52
|
-
data-testid="chevron-motion"
|
|
53
|
-
>
|
|
54
|
-
<Icon name={ChevronRight} variant="fill" size="sm" color="primary" />
|
|
55
|
-
</m.div>
|
|
56
|
-
</AnimatePresence>
|
|
57
|
-
</Pressable>
|
|
58
|
-
<AnimatePresence initial={false}>
|
|
59
|
-
<m.div
|
|
60
|
-
key="content"
|
|
61
|
-
initial="collapsed"
|
|
62
|
-
animate={open ? 'open' : 'collapsed'}
|
|
63
|
-
exit="collapsed"
|
|
64
|
-
variants={{ open: { height: 'auto' }, collapsed: { height: 0, overflow: 'hidden' } }}
|
|
65
|
-
>
|
|
66
|
-
<VStack spacingHorizontal={spacingHorizontal} {..._content}>
|
|
67
|
-
{children}
|
|
68
|
-
</VStack>
|
|
69
|
-
</m.div>
|
|
70
|
-
</AnimatePresence>
|
|
71
|
-
</SpringMotionConfig>
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
Accordion.displayName = 'Accordion';
|
|
76
|
-
|
|
77
|
-
export { Accordion, type AccordionProps };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { createContext, useContext } from 'react';
|
|
2
|
-
|
|
3
|
-
const AvoidMotionLibrary = createContext<boolean>(false);
|
|
4
|
-
const AvoidMotionLibraryProvider = AvoidMotionLibrary.Provider;
|
|
5
|
-
|
|
6
|
-
const useAvoidMotionLibrary = () => {
|
|
7
|
-
return useContext(AvoidMotionLibrary);
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export { AvoidMotionLibraryProvider, useAvoidMotionLibrary };
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/* eslint-disable react/no-multi-comp */
|
|
2
|
-
import type { DialogProps, DialogStore as ModalStore } from '@ariakit/react';
|
|
3
|
-
import { Dialog, DialogDismiss, useDialogStore } from '@ariakit/react';
|
|
4
|
-
import { Cross } from '@yahoo/uds-icons';
|
|
5
|
-
|
|
6
|
-
import { cx } from '../../../styles/styler';
|
|
7
|
-
import { HStack, Text, VStack } from '../..';
|
|
8
|
-
import { IconButton } from '../../client/IconButton';
|
|
9
|
-
|
|
10
|
-
type ModalProps = DialogProps;
|
|
11
|
-
|
|
12
|
-
function useModalStore(params?: Parameters<typeof useDialogStore>[0]) {
|
|
13
|
-
return useDialogStore({ animated: true, ...params });
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
interface ModalHeaderProps extends React.PropsWithChildren {
|
|
17
|
-
handleClose?: () => void;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function ModalHeader({ children, handleClose }: ModalHeaderProps) {
|
|
21
|
-
return (
|
|
22
|
-
<HStack alignItems="center" justifyContent="space-between">
|
|
23
|
-
<Text variant="headline1" color="primary">
|
|
24
|
-
{children}
|
|
25
|
-
</Text>
|
|
26
|
-
<IconButton
|
|
27
|
-
aria-label="Close"
|
|
28
|
-
size="sm"
|
|
29
|
-
variant="tertiary"
|
|
30
|
-
name={Cross}
|
|
31
|
-
onClick={handleClose}
|
|
32
|
-
/>
|
|
33
|
-
</HStack>
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
ModalHeader.displayName = 'ModalHeader';
|
|
38
|
-
|
|
39
|
-
function Modal({ className, ...props }: ModalProps) {
|
|
40
|
-
return (
|
|
41
|
-
<VStack
|
|
42
|
-
borderRadius="md"
|
|
43
|
-
position="fixed"
|
|
44
|
-
backgroundColor="primary"
|
|
45
|
-
dropShadow="md"
|
|
46
|
-
className={cx(
|
|
47
|
-
'inset-8 top-[250px] z-50 mx-auto h-fit w-[600px] origin-center scale-95 opacity-0 transition duration-150 data-[enter]:scale-100 data-[enter]:opacity-100',
|
|
48
|
-
className,
|
|
49
|
-
)}
|
|
50
|
-
spacing="8"
|
|
51
|
-
asChild
|
|
52
|
-
overflow="hidden"
|
|
53
|
-
>
|
|
54
|
-
<Dialog
|
|
55
|
-
backdrop={
|
|
56
|
-
<div className="data-[enter]:bg-primary opacity-0 backdrop-blur-0 transition duration-150 data-[enter]:opacity-60 data-[enter]:backdrop-blur-sm" />
|
|
57
|
-
}
|
|
58
|
-
{...props}
|
|
59
|
-
/>
|
|
60
|
-
</VStack>
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
Modal.displayName = 'Modal';
|
|
65
|
-
|
|
66
|
-
const ModalDismiss: typeof DialogDismiss = DialogDismiss;
|
|
67
|
-
|
|
68
|
-
export { Modal, ModalDismiss, ModalHeader, type ModalProps, type ModalStore, useModalStore };
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import type { PopoverProps as OriginalPopoverProps } from '@ariakit/react';
|
|
2
|
-
import {
|
|
3
|
-
Popover as OriginalPopover,
|
|
4
|
-
PopoverAnchor as OriginalPopoverAnchor,
|
|
5
|
-
PopoverArrow as OriginalPopoverArrow,
|
|
6
|
-
PopoverDescription as OriginalPopoverDescription,
|
|
7
|
-
PopoverDisclosure as OriginalPopoverDisclosure,
|
|
8
|
-
PopoverDisclosureArrow as OriginalPopoverDisclosureArrow,
|
|
9
|
-
PopoverDismiss as OriginalPopoverDismiss,
|
|
10
|
-
PopoverHeading as OriginalPopoverHeading,
|
|
11
|
-
PopoverProvider as OriginalPopoverProvider,
|
|
12
|
-
usePopoverStore,
|
|
13
|
-
} from '@ariakit/react';
|
|
14
|
-
import type { PropsWithChildren } from 'react';
|
|
15
|
-
import React from 'react';
|
|
16
|
-
|
|
17
|
-
import { HStack, Text } from '../..';
|
|
18
|
-
|
|
19
|
-
interface PopoverHeadingProps extends PropsWithChildren {
|
|
20
|
-
leading?: React.ReactNode;
|
|
21
|
-
trailing?: React.ReactNode;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function PopoverHeading({ children, leading, trailing }: PopoverHeadingProps) {
|
|
25
|
-
return (
|
|
26
|
-
<HStack>
|
|
27
|
-
{leading}
|
|
28
|
-
<Text variant="headline1" color="primary" asChild>
|
|
29
|
-
<OriginalPopoverHeading>{children}</OriginalPopoverHeading>
|
|
30
|
-
</Text>
|
|
31
|
-
{trailing}
|
|
32
|
-
</HStack>
|
|
33
|
-
);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
PopoverHeading.displayName = 'PopoverHeading';
|
|
37
|
-
|
|
38
|
-
type PopoverProps = Omit<OriginalPopoverProps, 'key'>;
|
|
39
|
-
|
|
40
|
-
const Popover = OriginalPopover;
|
|
41
|
-
const PopoverArrow: typeof OriginalPopoverArrow = OriginalPopoverArrow;
|
|
42
|
-
const PopoverAnchor: typeof OriginalPopoverAnchor = OriginalPopoverAnchor;
|
|
43
|
-
const PopoverDescription: typeof OriginalPopoverDescription = OriginalPopoverDescription;
|
|
44
|
-
const PopoverDismiss: typeof OriginalPopoverDismiss = OriginalPopoverDismiss;
|
|
45
|
-
const PopoverProvider: typeof OriginalPopoverProvider = OriginalPopoverProvider;
|
|
46
|
-
const PopoverDisclosure: typeof OriginalPopoverDisclosure = OriginalPopoverDisclosure;
|
|
47
|
-
const PopoverDisclosureArrow: typeof OriginalPopoverDisclosureArrow =
|
|
48
|
-
OriginalPopoverDisclosureArrow;
|
|
49
|
-
|
|
50
|
-
export {
|
|
51
|
-
Popover,
|
|
52
|
-
PopoverAnchor,
|
|
53
|
-
PopoverArrow,
|
|
54
|
-
PopoverDescription,
|
|
55
|
-
PopoverDisclosure,
|
|
56
|
-
PopoverDisclosureArrow,
|
|
57
|
-
PopoverDismiss,
|
|
58
|
-
PopoverHeading,
|
|
59
|
-
type PopoverHeadingProps,
|
|
60
|
-
type PopoverProps,
|
|
61
|
-
PopoverProvider,
|
|
62
|
-
usePopoverStore,
|
|
63
|
-
};
|