@primer/styled-react 1.0.0-rc.1 → 1.0.0-rc.10
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/README.md +18 -0
- package/dist/components/ActionList.d.ts +44 -0
- package/dist/components/ActionList.d.ts.map +1 -0
- package/dist/components/ActionList.js +163 -0
- package/dist/components/ActionMenu.d.ts +13 -0
- package/dist/components/ActionMenu.d.ts.map +1 -0
- package/dist/components/ActionMenu.js +19 -0
- package/dist/components/Autocomplete.d.ts +17 -0
- package/dist/components/Autocomplete.d.ts.map +1 -0
- package/dist/components/Autocomplete.js +25 -0
- package/dist/components/Avatar.d.ts +13 -0
- package/dist/components/Avatar.d.ts.map +1 -0
- package/dist/components/Avatar.js +14 -0
- package/dist/components/BaseStyles.d.ts +17 -0
- package/dist/components/BaseStyles.d.ts.map +1 -0
- package/dist/components/BaseStyles.js +51 -0
- package/dist/components/Box.d.ts +19 -0
- package/dist/components/Box.d.ts.map +1 -0
- package/dist/components/Box.js +15 -0
- package/dist/components/Breadcrumbs.d.ts +18 -0
- package/dist/components/Breadcrumbs.d.ts.map +1 -0
- package/dist/components/Breadcrumbs.js +38 -0
- package/dist/components/Button.d.ts +12 -0
- package/dist/components/Button.d.ts.map +1 -0
- package/dist/components/Button.js +112 -0
- package/dist/components/Checkbox.d.ts +5 -0
- package/dist/components/Checkbox.d.ts.map +1 -0
- package/dist/components/Checkbox.js +15 -0
- package/dist/components/CheckboxGroup.d.ts +34 -0
- package/dist/components/CheckboxGroup.d.ts.map +1 -0
- package/dist/components/CheckboxGroup.js +43 -0
- package/dist/components/CircleBadge.d.ts +8 -0
- package/dist/components/CircleBadge.d.ts.map +1 -0
- package/dist/components/CircleBadge.js +12 -0
- package/dist/components/CounterLabel.d.ts +10 -0
- package/dist/components/CounterLabel.d.ts.map +1 -0
- package/dist/components/CounterLabel.js +14 -0
- package/dist/components/DataTable.d.ts +11 -0
- package/dist/components/DataTable.d.ts.map +1 -0
- package/dist/components/DataTable.js +32 -0
- package/dist/components/Dialog.d.ts +19 -0
- package/dist/components/Dialog.d.ts.map +1 -0
- package/dist/components/Dialog.js +43 -0
- package/dist/components/FeatureFlaggedTheming.d.ts +9 -0
- package/dist/components/FeatureFlaggedTheming.d.ts.map +1 -0
- package/dist/components/FeatureFlaggedTheming.js +54 -0
- package/dist/components/Flash.d.ts +8 -0
- package/dist/components/Flash.d.ts.map +1 -0
- package/dist/components/Flash.js +12 -0
- package/dist/components/FormControl.d.ts +13 -0
- package/dist/components/FormControl.d.ts.map +1 -0
- package/dist/components/FormControl.js +19 -0
- package/dist/components/Header.d.ts +11 -0
- package/dist/components/Header.d.ts.map +1 -0
- package/dist/components/Header.js +52 -0
- package/dist/components/Heading.d.ts +8 -0
- package/dist/components/Heading.d.ts.map +1 -0
- package/dist/components/Heading.js +12 -0
- package/dist/components/IconButton.d.ts +10 -0
- package/dist/components/IconButton.d.ts.map +1 -0
- package/dist/components/IconButton.js +40 -0
- package/dist/components/Label.d.ts +9 -0
- package/dist/components/Label.d.ts.map +1 -0
- package/dist/components/Label.js +26 -0
- package/dist/components/Link.d.ts +7 -0
- package/dist/components/Link.d.ts.map +1 -0
- package/dist/components/Link.js +26 -0
- package/dist/components/LinkButton.d.ts +8 -0
- package/dist/components/LinkButton.d.ts.map +1 -0
- package/dist/components/LinkButton.js +12 -0
- package/dist/components/NavList.d.ts +30 -0
- package/dist/components/NavList.d.ts.map +1 -0
- package/dist/components/NavList.js +74 -0
- package/dist/components/Overlay.d.ts +8 -0
- package/dist/components/Overlay.d.ts.map +1 -0
- package/dist/components/Overlay.js +12 -0
- package/dist/components/PageHeader.d.ts +31 -0
- package/dist/components/PageHeader.d.ts.map +1 -0
- package/dist/components/PageHeader.js +109 -0
- package/dist/components/PageLayout.d.ts +23 -0
- package/dist/components/PageLayout.d.ts.map +1 -0
- package/dist/components/PageLayout.js +43 -0
- package/dist/components/RadioGroup.d.ts +34 -0
- package/dist/components/RadioGroup.d.ts.map +1 -0
- package/dist/components/RadioGroup.js +43 -0
- package/dist/components/RelativeTime.d.ts +6 -0
- package/dist/components/RelativeTime.d.ts.map +1 -0
- package/dist/components/RelativeTime.js +14 -0
- package/dist/components/SegmentedControl.d.ts +19 -0
- package/dist/components/SegmentedControl.d.ts.map +1 -0
- package/dist/components/SegmentedControl.js +31 -0
- package/dist/components/Select.d.ts +8 -0
- package/dist/components/Select.d.ts.map +1 -0
- package/dist/components/Select.js +24 -0
- package/dist/components/Spinner.d.ts +5 -0
- package/dist/components/Spinner.d.ts.map +1 -0
- package/dist/components/Spinner.js +12 -0
- package/dist/components/StateLabel.d.ts +9 -0
- package/dist/components/StateLabel.d.ts.map +1 -0
- package/dist/components/StateLabel.js +14 -0
- package/dist/components/SubNav.d.ts +10 -0
- package/dist/components/SubNav.d.ts.map +1 -0
- package/dist/components/SubNav.js +26 -0
- package/dist/components/Text.d.ts +15 -0
- package/dist/components/Text.d.ts.map +1 -0
- package/dist/components/Text.js +26 -0
- package/dist/components/TextInput.d.ts +15 -0
- package/dist/components/TextInput.d.ts.map +1 -0
- package/dist/components/TextInput.js +38 -0
- package/dist/components/Textarea.d.ts +9 -0
- package/dist/components/Textarea.d.ts.map +1 -0
- package/dist/components/Textarea.js +26 -0
- package/dist/components/ThemeProvider.d.ts +30 -0
- package/dist/components/ThemeProvider.d.ts.map +1 -0
- package/dist/components/ThemeProvider.js +202 -0
- package/dist/components/Timeline.d.ts +26 -0
- package/dist/components/Timeline.d.ts.map +1 -0
- package/dist/components/Timeline.js +47 -0
- package/dist/components/ToggleSwitch.d.ts +6 -0
- package/dist/components/ToggleSwitch.d.ts.map +1 -0
- package/dist/components/ToggleSwitch.js +14 -0
- package/dist/components/Token.d.ts +8 -0
- package/dist/components/Token.d.ts.map +1 -0
- package/dist/components/Token.js +26 -0
- package/dist/components/Tooltip.d.ts +7 -0
- package/dist/components/Tooltip.d.ts.map +1 -0
- package/dist/components/Tooltip.js +15 -0
- package/dist/components/Truncate.d.ts +7 -0
- package/dist/components/Truncate.d.ts.map +1 -0
- package/dist/components/Truncate.js +12 -0
- package/dist/components/UnderlineNav.d.ts +11 -0
- package/dist/components/UnderlineNav.d.ts.map +1 -0
- package/dist/components/UnderlineNav.js +45 -0
- package/dist/components/UnderlinePanels.d.ts +14 -0
- package/dist/components/UnderlinePanels.d.ts.map +1 -0
- package/dist/components/UnderlinePanels.js +28 -0
- package/dist/components/deprecated/ActionList.d.ts +23 -0
- package/dist/components/deprecated/ActionList.d.ts.map +1 -0
- package/dist/components/deprecated/ActionList.js +49 -0
- package/dist/components/deprecated/DialogV1.d.ts +11 -0
- package/dist/components/deprecated/DialogV1.d.ts.map +1 -0
- package/dist/components/deprecated/DialogV1.js +44 -0
- package/dist/components/deprecated/Octicon.d.ts +17 -0
- package/dist/components/deprecated/Octicon.d.ts.map +1 -0
- package/dist/components/deprecated/Octicon.js +39 -0
- package/dist/components/deprecated/TabNav.d.ts +9 -0
- package/dist/components/deprecated/TabNav.d.ts.map +1 -0
- package/dist/components/deprecated/TabNav.js +44 -0
- package/dist/components/deprecated/Tooltip.d.ts +13 -0
- package/dist/components/deprecated/Tooltip.d.ts.map +1 -0
- package/dist/components/deprecated/Tooltip.js +32 -0
- package/dist/components.json +138 -0
- package/dist/deprecated.d.ts +5 -1
- package/dist/deprecated.d.ts.map +1 -1
- package/dist/deprecated.js +5 -1
- package/dist/experimental.d.ts +5 -1
- package/dist/experimental.d.ts.map +1 -1
- package/dist/experimental.js +5 -1
- package/dist/index.d.ts +47 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +45 -12
- package/dist/polymorphic.d.ts +38 -0
- package/dist/polymorphic.d.ts.map +1 -0
- package/dist/styled-props.d.ts +4 -0
- package/dist/styled-props.d.ts.map +1 -0
- package/dist/sx.d.ts +26 -0
- package/dist/sx.d.ts.map +1 -0
- package/dist/sx.js +8 -0
- package/package.json +8 -5
- package/dist/utils/createStyledComponent.d.ts +0 -20
- package/dist/utils/createStyledComponent.d.ts.map +0 -1
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { SegmentedControl as SegmentedControl$1 } from '@primer/react';
|
|
2
|
+
import Box from './Box.js';
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
const SegmentedControlButton = props => {
|
|
6
|
+
return /*#__PURE__*/jsx(Box, {
|
|
7
|
+
as: SegmentedControl$1.Button,
|
|
8
|
+
...props
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
const SegmentedControlIconButton = props => {
|
|
12
|
+
return /*#__PURE__*/jsx(Box, {
|
|
13
|
+
as: SegmentedControl$1.IconButton,
|
|
14
|
+
...props
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
const SegmentedControlImpl = props => {
|
|
18
|
+
return /*#__PURE__*/jsx(Box, {
|
|
19
|
+
as: SegmentedControl$1,
|
|
20
|
+
...props
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
const SegmentedControl = Object.assign(SegmentedControlImpl, {
|
|
24
|
+
__SLOT__: SegmentedControl$1.__SLOT__,
|
|
25
|
+
Button: SegmentedControlButton,
|
|
26
|
+
IconButton: SegmentedControlIconButton
|
|
27
|
+
});
|
|
28
|
+
SegmentedControlButton.__SLOT__ = SegmentedControl$1.Button.__SLOT__;
|
|
29
|
+
SegmentedControlIconButton.__SLOT__ = SegmentedControl$1.IconButton.__SLOT__;
|
|
30
|
+
|
|
31
|
+
export { SegmentedControl };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type SelectProps as PrimerSelectProps } from '@primer/react';
|
|
2
|
+
import { type SxProp } from '../sx';
|
|
3
|
+
type SelectProps = PrimerSelectProps & SxProp & {
|
|
4
|
+
as?: React.ElementType;
|
|
5
|
+
};
|
|
6
|
+
declare const Select: ({ as, ...props }: SelectProps) => import("react").JSX.Element;
|
|
7
|
+
export { Select, type SelectProps };
|
|
8
|
+
//# sourceMappingURL=Select.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../src/components/Select.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAyB,KAAK,WAAW,IAAI,iBAAiB,EAAC,MAAM,eAAe,CAAA;AAC3F,OAAO,EAAK,KAAK,MAAM,EAAC,MAAM,OAAO,CAAA;AAIrC,KAAK,WAAW,GAAG,iBAAiB,GAAG,MAAM,GAAG;IAAC,EAAE,CAAC,EAAE,KAAK,CAAC,WAAW,CAAA;CAAC,CAAA;AAOxE,QAAA,MAAM,MAAM,GAAI,kBAAgB,WAAW,gCAE1C,CAAA;AAED,OAAO,EAAC,MAAM,EAAE,KAAK,WAAW,EAAC,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Select as Select$1 } from '@primer/react';
|
|
2
|
+
import sx from '../sx.js';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import { jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
const StyledSelect = styled(Select$1).withConfig({
|
|
7
|
+
shouldForwardProp: prop => prop !== 'sx'
|
|
8
|
+
}).withConfig({
|
|
9
|
+
displayName: "Select__StyledSelect",
|
|
10
|
+
componentId: "sc-1pyiuc8-0"
|
|
11
|
+
})(["", ""], sx);
|
|
12
|
+
const Select = ({
|
|
13
|
+
as,
|
|
14
|
+
...props
|
|
15
|
+
}) => {
|
|
16
|
+
return /*#__PURE__*/jsx(StyledSelect, {
|
|
17
|
+
...props,
|
|
18
|
+
...(as ? {
|
|
19
|
+
forwardedAs: as
|
|
20
|
+
} : {})
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export { Select };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Spinner as PrimerSpinner, type SpinnerProps as PrimerSpinnerProps } from '@primer/react';
|
|
2
|
+
import { type SxProp } from '../sx';
|
|
3
|
+
export type SpinnerProps = PrimerSpinnerProps & SxProp;
|
|
4
|
+
export declare const Spinner: import("styled-components").StyledComponent<typeof PrimerSpinner, any, SpinnerProps, never>;
|
|
5
|
+
//# sourceMappingURL=Spinner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Spinner.d.ts","sourceRoot":"","sources":["../../src/components/Spinner.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,IAAI,aAAa,EAAE,KAAK,YAAY,IAAI,kBAAkB,EAAC,MAAM,eAAe,CAAA;AAC/F,OAAO,EAAK,KAAK,MAAM,EAAC,MAAM,OAAO,CAAA;AAGrC,MAAM,MAAM,YAAY,GAAG,kBAAkB,GAAG,MAAM,CAAA;AAEtD,eAAO,MAAM,OAAO,6FAInB,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Spinner as Spinner$1 } from '@primer/react';
|
|
2
|
+
import sx from '../sx.js';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
|
|
5
|
+
const Spinner = styled(Spinner$1).withConfig({
|
|
6
|
+
shouldForwardProp: prop => prop !== 'sx'
|
|
7
|
+
}).withConfig({
|
|
8
|
+
displayName: "Spinner",
|
|
9
|
+
componentId: "sc-jbw2a0-0"
|
|
10
|
+
})(["", ""], sx);
|
|
11
|
+
|
|
12
|
+
export { Spinner };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type StateLabelProps as PrimerStateLabelProps } from '@primer/react';
|
|
2
|
+
import type { SxProp } from '../sx';
|
|
3
|
+
type StateLabelProps = PrimerStateLabelProps & SxProp;
|
|
4
|
+
declare const StateLabel: import("react").ForwardRefExoticComponent<import("react").HTMLAttributes<HTMLSpanElement> & {
|
|
5
|
+
variant?: "small" | "normal";
|
|
6
|
+
status: "open" | "closed" | "issueOpened" | "pullOpened" | "issueClosed" | "issueClosedNotPlanned" | "pullClosed" | "pullMerged" | "draft" | "issueDraft" | "pullQueued" | "unavailable";
|
|
7
|
+
} & SxProp & import("react").RefAttributes<HTMLSpanElement>>;
|
|
8
|
+
export { StateLabel, type StateLabelProps };
|
|
9
|
+
//# sourceMappingURL=StateLabel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StateLabel.d.ts","sourceRoot":"","sources":["../../src/components/StateLabel.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiC,KAAK,eAAe,IAAI,qBAAqB,EAAC,MAAM,eAAe,CAAA;AAG3G,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,OAAO,CAAA;AAEjC,KAAK,eAAe,GAAG,qBAAqB,GAAG,MAAM,CAAA;AAErD,QAAA,MAAM,UAAU;;;4DAEd,CAAA;AAEF,OAAO,EAAC,UAAU,EAAE,KAAK,eAAe,EAAC,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { StateLabel as StateLabel$1 } from '@primer/react';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import Box from './Box.js';
|
|
4
|
+
import { jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
const StateLabel = /*#__PURE__*/forwardRef(function StateLabel(props, ref) {
|
|
7
|
+
return /*#__PURE__*/jsx(Box, {
|
|
8
|
+
as: StateLabel$1,
|
|
9
|
+
ref: ref,
|
|
10
|
+
...props
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export { StateLabel };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type SubNavProps as PrimerSubNavProps, type SubNavLinkProps as PrimerSubNavLinkProps } from '@primer/react';
|
|
2
|
+
import type { SxProp } from '../sx';
|
|
3
|
+
type SubNavProps = PrimerSubNavProps & SxProp;
|
|
4
|
+
type SubNavLinkProps = PrimerSubNavLinkProps & SxProp;
|
|
5
|
+
declare const SubNav: import("react").ForwardRefExoticComponent<Omit<SubNavProps, "ref"> & import("react").RefAttributes<HTMLElement>> & {
|
|
6
|
+
__SLOT__: symbol;
|
|
7
|
+
Link: import("react").ForwardRefExoticComponent<Omit<SubNavLinkProps, "ref"> & import("react").RefAttributes<HTMLAnchorElement>>;
|
|
8
|
+
};
|
|
9
|
+
export { SubNav, type SubNavProps, type SubNavLinkProps };
|
|
10
|
+
//# sourceMappingURL=SubNav.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SubNav.d.ts","sourceRoot":"","sources":["../../src/components/SubNav.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,WAAW,IAAI,iBAAiB,EACrC,KAAK,eAAe,IAAI,qBAAqB,EAE9C,MAAM,eAAe,CAAA;AAGtB,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,OAAO,CAAA;AAEjC,KAAK,WAAW,GAAG,iBAAiB,GAAG,MAAM,CAAA;AAM7C,KAAK,eAAe,GAAG,qBAAqB,GAAG,MAAM,CAAA;AAMrD,QAAA,MAAM,MAAM;;;CAGV,CAED;AAED,OAAO,EAAC,MAAM,EAAE,KAAK,WAAW,EAAE,KAAK,eAAe,EAAC,CAAA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { SubNav as SubNav$1 } from '@primer/react';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import Box from './Box.js';
|
|
4
|
+
import { jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
const SubNavImpl = /*#__PURE__*/forwardRef(function SubNav(props, ref) {
|
|
7
|
+
return /*#__PURE__*/jsx(Box, {
|
|
8
|
+
as: SubNav$1,
|
|
9
|
+
ref: ref,
|
|
10
|
+
...props
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
const SubNavLink = /*#__PURE__*/forwardRef(function SubNavLink(props, ref) {
|
|
14
|
+
return /*#__PURE__*/jsx(Box, {
|
|
15
|
+
as: SubNav$1.Link,
|
|
16
|
+
ref: ref,
|
|
17
|
+
...props
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
const SubNav = Object.assign(SubNavImpl, {
|
|
21
|
+
__SLOT__: SubNav$1.__SLOT__,
|
|
22
|
+
Link: SubNavLink
|
|
23
|
+
});
|
|
24
|
+
SubNavLink.__SLOT__ = SubNav$1.Link.__SLOT__;
|
|
25
|
+
|
|
26
|
+
export { SubNav };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type TextProps as PrimerTextProps } from '@primer/react';
|
|
2
|
+
import { type SxProp } from '../sx';
|
|
3
|
+
import type React from 'react';
|
|
4
|
+
import type { ForwardRefComponent } from '../polymorphic';
|
|
5
|
+
type BaseTextProps = {
|
|
6
|
+
size?: 'large' | 'medium' | 'small';
|
|
7
|
+
weight?: 'light' | 'normal' | 'medium' | 'semibold';
|
|
8
|
+
className?: string;
|
|
9
|
+
children?: React.ReactNode;
|
|
10
|
+
as?: React.ElementType;
|
|
11
|
+
} & SxProp & React.HTMLAttributes<HTMLElement>;
|
|
12
|
+
type TextProps<As extends React.ElementType = 'span'> = PrimerTextProps<As> & SxProp;
|
|
13
|
+
declare const Text: ForwardRefComponent<"span", BaseTextProps>;
|
|
14
|
+
export { Text, type TextProps };
|
|
15
|
+
//# sourceMappingURL=Text.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../src/components/Text.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,SAAS,IAAI,eAAe,EAAC,MAAM,eAAe,CAAA;AACnF,OAAO,EAAK,KAAK,MAAM,EAAC,MAAM,OAAO,CAAA;AAErC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,gBAAgB,CAAA;AAGvD,KAAK,aAAa,GAAG;IACnB,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAA;IACnC,MAAM,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,CAAA;IACnD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B,EAAE,CAAC,EAAE,KAAK,CAAC,WAAW,CAAA;CACvB,GAAG,MAAM,GACR,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,CAAA;AAGnC,KAAK,SAAS,CAAC,EAAE,SAAS,KAAK,CAAC,WAAW,GAAG,MAAM,IAAI,eAAe,CAAC,EAAE,CAAC,GAAG,MAAM,CAAA;AAQpF,QAAA,MAAM,IAAI,EAEJ,mBAAmB,CAAC,MAAM,EAAE,aAAa,CAAC,CAAA;AAEhD,OAAO,EAAC,IAAI,EAAE,KAAK,SAAS,EAAC,CAAA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Text as Text$1 } from '@primer/react';
|
|
2
|
+
import sx from '../sx.js';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import { forwardRef } from 'react';
|
|
5
|
+
import { jsx } from 'react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
const StyledText = styled(Text$1).withConfig({
|
|
8
|
+
shouldForwardProp: prop => prop !== 'sx'
|
|
9
|
+
}).withConfig({
|
|
10
|
+
displayName: "Text__StyledText",
|
|
11
|
+
componentId: "sc-1klmep6-0"
|
|
12
|
+
})(["", ""], sx);
|
|
13
|
+
const Text = /*#__PURE__*/forwardRef(({
|
|
14
|
+
as,
|
|
15
|
+
...props
|
|
16
|
+
}, ref) => {
|
|
17
|
+
return /*#__PURE__*/jsx(StyledText, {
|
|
18
|
+
...props,
|
|
19
|
+
...(as ? {
|
|
20
|
+
forwardedAs: as
|
|
21
|
+
} : {}),
|
|
22
|
+
ref: ref
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export { Text };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type TextInputProps as PrimerTextInputProps, type TextInputActionProps as PrimerTextInputActionProps } from '@primer/react';
|
|
2
|
+
import { type ForwardRefExoticComponent, type RefAttributes } from 'react';
|
|
3
|
+
import { type SxProp } from '../sx';
|
|
4
|
+
import { type ForwardRefComponent } from '../polymorphic';
|
|
5
|
+
export type TextInputProps = PrimerTextInputProps & SxProp & {
|
|
6
|
+
as?: React.ElementType;
|
|
7
|
+
};
|
|
8
|
+
export type TextInputActionProps = PrimerTextInputActionProps & SxProp;
|
|
9
|
+
declare const TextInputAction: ForwardRefComponent<'button', TextInputActionProps>;
|
|
10
|
+
type TextInputComposite = ForwardRefExoticComponent<TextInputProps & RefAttributes<HTMLInputElement>> & {
|
|
11
|
+
Action: typeof TextInputAction;
|
|
12
|
+
};
|
|
13
|
+
export declare const TextInput: TextInputComposite;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=TextInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextInput.d.ts","sourceRoot":"","sources":["../../src/components/TextInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,cAAc,IAAI,oBAAoB,EAC3C,KAAK,oBAAoB,IAAI,0BAA0B,EACxD,MAAM,eAAe,CAAA;AACtB,OAAO,EAAa,KAAK,yBAAyB,EAAE,KAAK,aAAa,EAAC,MAAM,OAAO,CAAA;AACpF,OAAO,EAAK,KAAK,MAAM,EAAC,MAAM,OAAO,CAAA;AACrC,OAAO,EAAC,KAAK,mBAAmB,EAAC,MAAM,gBAAgB,CAAA;AAGvD,MAAM,MAAM,cAAc,GAAG,oBAAoB,GAAG,MAAM,GAAG;IAAC,EAAE,CAAC,EAAE,KAAK,CAAC,WAAW,CAAA;CAAC,CAAA;AACrF,MAAM,MAAM,oBAAoB,GAAG,0BAA0B,GAAG,MAAM,CAAA;AAYtE,QAAA,MAAM,eAAe,EAAE,mBAAmB,CAAC,QAAQ,EAAE,oBAAoB,CAIxE,CAAA;AAED,KAAK,kBAAkB,GAAG,yBAAyB,CAAC,cAAc,GAAG,aAAa,CAAC,gBAAgB,CAAC,CAAC,GAAG;IACtG,MAAM,EAAE,OAAO,eAAe,CAAA;CAC/B,CAAA;AAED,eAAO,MAAM,SAAS,EAAE,kBAGtB,CAAA"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { TextInput as TextInput$1 } from '@primer/react';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import sx from '../sx.js';
|
|
4
|
+
import styled from 'styled-components';
|
|
5
|
+
import { jsx } from 'react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
const StyledTextInput = styled(TextInput$1).withConfig({
|
|
8
|
+
shouldForwardProp: prop => prop !== 'sx'
|
|
9
|
+
}).withConfig({
|
|
10
|
+
displayName: "TextInput__StyledTextInput",
|
|
11
|
+
componentId: "sc-ttxlvl-0"
|
|
12
|
+
})(["", ""], sx);
|
|
13
|
+
const TextInputImpl = /*#__PURE__*/forwardRef(({
|
|
14
|
+
as,
|
|
15
|
+
...props
|
|
16
|
+
}, ref) => {
|
|
17
|
+
return /*#__PURE__*/jsx(StyledTextInput, {
|
|
18
|
+
ref: ref,
|
|
19
|
+
...props,
|
|
20
|
+
...(as ? {
|
|
21
|
+
forwardedAs: as
|
|
22
|
+
} : {})
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
const TextInputAction = styled(TextInput$1.Action).withConfig({
|
|
26
|
+
shouldForwardProp: prop => prop !== 'sx'
|
|
27
|
+
}).withConfig({
|
|
28
|
+
displayName: "TextInput__TextInputAction",
|
|
29
|
+
componentId: "sc-ttxlvl-1"
|
|
30
|
+
})(["", ""], sx);
|
|
31
|
+
const TextInput = Object.assign(TextInputImpl, {
|
|
32
|
+
__SLOT__: TextInput$1.__SLOT__,
|
|
33
|
+
Action: TextInputAction
|
|
34
|
+
});
|
|
35
|
+
TextInputAction.displayName = 'TextInputAction';
|
|
36
|
+
TextInputImpl.displayName = 'TextInput';
|
|
37
|
+
|
|
38
|
+
export { TextInput };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type TextareaProps as PrimerTextareaProps } from '@primer/react';
|
|
2
|
+
import { type SxProp } from '../sx';
|
|
3
|
+
import type { ForwardRefComponent } from '../polymorphic';
|
|
4
|
+
type TextareaProps = PrimerTextareaProps & SxProp & {
|
|
5
|
+
as?: React.ElementType;
|
|
6
|
+
};
|
|
7
|
+
declare const Textarea: ForwardRefComponent<"textarea", TextareaProps>;
|
|
8
|
+
export { Textarea, type TextareaProps };
|
|
9
|
+
//# sourceMappingURL=Textarea.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Textarea.d.ts","sourceRoot":"","sources":["../../src/components/Textarea.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6B,KAAK,aAAa,IAAI,mBAAmB,EAAC,MAAM,eAAe,CAAA;AAEnG,OAAO,EAAK,KAAK,MAAM,EAAC,MAAM,OAAO,CAAA;AACrC,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,gBAAgB,CAAA;AAGvD,KAAK,aAAa,GAAG,mBAAmB,GAAG,MAAM,GAAG;IAAC,EAAE,CAAC,EAAE,KAAK,CAAC,WAAW,CAAA;CAAC,CAAA;AAQ5E,QAAA,MAAM,QAAQ,EAER,mBAAmB,CAAC,UAAU,EAAE,aAAa,CAAC,CAAA;AAEpD,OAAO,EAAC,QAAQ,EAAE,KAAK,aAAa,EAAC,CAAA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Textarea as Textarea$1 } from '@primer/react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import sx from '../sx.js';
|
|
4
|
+
import { forwardRef } from 'react';
|
|
5
|
+
import { jsx } from 'react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
const StyledTextarea = styled(Textarea$1).withConfig({
|
|
8
|
+
shouldForwardProp: prop => prop !== 'sx'
|
|
9
|
+
}).withConfig({
|
|
10
|
+
displayName: "Textarea__StyledTextarea",
|
|
11
|
+
componentId: "sc-40d1gp-0"
|
|
12
|
+
})(["", ""], sx);
|
|
13
|
+
const Textarea = /*#__PURE__*/forwardRef(({
|
|
14
|
+
as,
|
|
15
|
+
...props
|
|
16
|
+
}, ref) => {
|
|
17
|
+
return /*#__PURE__*/jsx(StyledTextarea, {
|
|
18
|
+
...props,
|
|
19
|
+
...(as ? {
|
|
20
|
+
forwardedAs: as
|
|
21
|
+
} : {}),
|
|
22
|
+
ref: ref
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export { Textarea };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare const defaultColorMode = "day";
|
|
3
|
+
export type Theme = {
|
|
4
|
+
[key: string]: any;
|
|
5
|
+
};
|
|
6
|
+
type ColorMode = 'day' | 'night' | 'light' | 'dark';
|
|
7
|
+
export type ColorModeWithAuto = ColorMode | 'auto';
|
|
8
|
+
export type ThemeProviderProps = {
|
|
9
|
+
theme?: Theme;
|
|
10
|
+
colorMode?: ColorModeWithAuto;
|
|
11
|
+
dayScheme?: string;
|
|
12
|
+
nightScheme?: string;
|
|
13
|
+
preventSSRMismatch?: boolean;
|
|
14
|
+
};
|
|
15
|
+
export declare const ThemeProvider: React.FC<React.PropsWithChildren<ThemeProviderProps>>;
|
|
16
|
+
export declare function useTheme(): {
|
|
17
|
+
theme?: Theme;
|
|
18
|
+
colorScheme?: string;
|
|
19
|
+
colorMode?: ColorModeWithAuto;
|
|
20
|
+
resolvedColorMode?: ColorMode;
|
|
21
|
+
resolvedColorScheme?: string;
|
|
22
|
+
dayScheme?: string;
|
|
23
|
+
nightScheme?: string;
|
|
24
|
+
setColorMode: React.Dispatch<React.SetStateAction<ColorModeWithAuto>>;
|
|
25
|
+
setDayScheme: React.Dispatch<React.SetStateAction<string>>;
|
|
26
|
+
setNightScheme: React.Dispatch<React.SetStateAction<string>>;
|
|
27
|
+
};
|
|
28
|
+
export declare function useColorSchemeVar(values: Partial<Record<string, string>>, fallback: string): string;
|
|
29
|
+
export default ThemeProvider;
|
|
30
|
+
//# sourceMappingURL=ThemeProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../src/components/ThemeProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAMzB,eAAO,MAAM,gBAAgB,QAAQ,CAAA;AAKrC,MAAM,MAAM,KAAK,GAAG;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAC,CAAA;AACxC,KAAK,SAAS,GAAG,KAAK,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,CAAA;AACnD,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,MAAM,CAAA;AAElD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,CAAC,EAAE,KAAK,CAAA;IACb,SAAS,CAAC,EAAE,iBAAiB,CAAA;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAC7B,CAAA;AA8BD,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,kBAAkB,CAAC,CAiF/E,CAAA;AAED,wBAAgB,QAAQ;YA9Gd,KAAK;kBACC,MAAM;gBACR,iBAAiB;wBACT,SAAS;0BACP,MAAM;gBAChB,MAAM;kBACJ,MAAM;kBACN,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAAC;kBACvD,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;oBAC1C,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;EAuG7D;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,UAG1F;AAqGD,eAAe,aAAa,CAAA"}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import ReactDOM from 'react-dom';
|
|
3
|
+
import { ThemeProvider as ThemeProvider$1 } from 'styled-components';
|
|
4
|
+
import { theme, useId, useSyncedState } from '@primer/react';
|
|
5
|
+
import deepmerge from 'deepmerge';
|
|
6
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
7
|
+
|
|
8
|
+
const defaultColorMode = 'day';
|
|
9
|
+
const defaultDayScheme = 'light';
|
|
10
|
+
const defaultNightScheme = 'dark';
|
|
11
|
+
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13
|
+
|
|
14
|
+
const ThemeContext = /*#__PURE__*/React.createContext({
|
|
15
|
+
setColorMode: () => null,
|
|
16
|
+
setDayScheme: () => null,
|
|
17
|
+
setNightScheme: () => null
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
// inspired from __NEXT_DATA__, we use application/json to avoid CSRF policy with inline scripts
|
|
21
|
+
const getServerHandoff = id => {
|
|
22
|
+
try {
|
|
23
|
+
const serverData = document.getElementById(`__PRIMER_DATA_${id}__`)?.textContent;
|
|
24
|
+
if (serverData) return JSON.parse(serverData);
|
|
25
|
+
} catch (_error) {
|
|
26
|
+
// if document/element does not exist or JSON is invalid, supress error
|
|
27
|
+
}
|
|
28
|
+
return {};
|
|
29
|
+
};
|
|
30
|
+
const ThemeProvider = ({
|
|
31
|
+
children,
|
|
32
|
+
...props
|
|
33
|
+
}) => {
|
|
34
|
+
// Get fallback values from parent ThemeProvider (if exists)
|
|
35
|
+
const {
|
|
36
|
+
theme: fallbackTheme,
|
|
37
|
+
colorMode: fallbackColorMode,
|
|
38
|
+
dayScheme: fallbackDayScheme,
|
|
39
|
+
nightScheme: fallbackNightScheme
|
|
40
|
+
} = useTheme();
|
|
41
|
+
|
|
42
|
+
// Initialize state
|
|
43
|
+
const theme$1 = props.theme ?? fallbackTheme ?? theme;
|
|
44
|
+
const uniqueDataId = useId();
|
|
45
|
+
const {
|
|
46
|
+
resolvedServerColorMode
|
|
47
|
+
} = getServerHandoff(uniqueDataId);
|
|
48
|
+
const resolvedColorModePassthrough = React.useRef(resolvedServerColorMode);
|
|
49
|
+
const [colorMode, setColorMode] = useSyncedState(props.colorMode ?? fallbackColorMode ?? defaultColorMode);
|
|
50
|
+
const [dayScheme, setDayScheme] = useSyncedState(props.dayScheme ?? fallbackDayScheme ?? defaultDayScheme);
|
|
51
|
+
const [nightScheme, setNightScheme] = useSyncedState(props.nightScheme ?? fallbackNightScheme ?? defaultNightScheme);
|
|
52
|
+
const systemColorMode = useSystemColorMode();
|
|
53
|
+
const resolvedColorMode = resolvedColorModePassthrough.current || resolveColorMode(colorMode, systemColorMode);
|
|
54
|
+
const colorScheme = chooseColorScheme(resolvedColorMode, dayScheme, nightScheme);
|
|
55
|
+
const {
|
|
56
|
+
resolvedTheme,
|
|
57
|
+
resolvedColorScheme
|
|
58
|
+
} = React.useMemo(() => applyColorScheme(theme$1, colorScheme), [theme$1, colorScheme]);
|
|
59
|
+
|
|
60
|
+
// this effect will only run on client
|
|
61
|
+
React.useEffect(function updateColorModeAfterServerPassthrough() {
|
|
62
|
+
const resolvedColorModeOnClient = resolveColorMode(colorMode, systemColorMode);
|
|
63
|
+
if (resolvedColorModePassthrough.current) {
|
|
64
|
+
// if the resolved color mode passed on from the server is not the resolved color mode on client, change it!
|
|
65
|
+
if (resolvedColorModePassthrough.current !== resolvedColorModeOnClient) {
|
|
66
|
+
window.setTimeout(() => {
|
|
67
|
+
// use ReactDOM.flushSync to prevent automatic batching of state updates since React 18
|
|
68
|
+
// ref: https://github.com/reactwg/react-18/discussions/21
|
|
69
|
+
ReactDOM.flushSync(() => {
|
|
70
|
+
// override colorMode to whatever is resolved on the client to get a re-render
|
|
71
|
+
setColorMode(resolvedColorModeOnClient);
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
// immediately after that, set the colorMode to what the user passed to respond to system color mode changes
|
|
75
|
+
setColorMode(colorMode);
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
resolvedColorModePassthrough.current = null;
|
|
79
|
+
}
|
|
80
|
+
}, [colorMode, systemColorMode, setColorMode]);
|
|
81
|
+
return /*#__PURE__*/jsx(ThemeContext.Provider, {
|
|
82
|
+
value: {
|
|
83
|
+
theme: resolvedTheme,
|
|
84
|
+
colorScheme,
|
|
85
|
+
colorMode,
|
|
86
|
+
resolvedColorMode,
|
|
87
|
+
resolvedColorScheme,
|
|
88
|
+
dayScheme,
|
|
89
|
+
nightScheme,
|
|
90
|
+
setColorMode,
|
|
91
|
+
setDayScheme,
|
|
92
|
+
setNightScheme
|
|
93
|
+
},
|
|
94
|
+
children: /*#__PURE__*/jsxs(ThemeProvider$1, {
|
|
95
|
+
theme: resolvedTheme,
|
|
96
|
+
children: [children, props.preventSSRMismatch ? /*#__PURE__*/jsx("script", {
|
|
97
|
+
type: "application/json",
|
|
98
|
+
id: `__PRIMER_DATA_${uniqueDataId}__`,
|
|
99
|
+
dangerouslySetInnerHTML: {
|
|
100
|
+
__html: JSON.stringify({
|
|
101
|
+
resolvedServerColorMode: resolvedColorMode
|
|
102
|
+
})
|
|
103
|
+
}
|
|
104
|
+
}) : null]
|
|
105
|
+
})
|
|
106
|
+
});
|
|
107
|
+
};
|
|
108
|
+
function useTheme() {
|
|
109
|
+
return React.useContext(ThemeContext);
|
|
110
|
+
}
|
|
111
|
+
function useColorSchemeVar(values, fallback) {
|
|
112
|
+
const {
|
|
113
|
+
colorScheme = ''
|
|
114
|
+
} = useTheme();
|
|
115
|
+
return values[colorScheme] ?? fallback;
|
|
116
|
+
}
|
|
117
|
+
function useSystemColorMode() {
|
|
118
|
+
const [systemColorMode, setSystemColorMode] = React.useState(getSystemColorMode);
|
|
119
|
+
React.useEffect(() => {
|
|
120
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
121
|
+
const media = window?.matchMedia?.('(prefers-color-scheme: dark)');
|
|
122
|
+
function matchesMediaToColorMode(matches) {
|
|
123
|
+
return matches ? 'night' : 'day';
|
|
124
|
+
}
|
|
125
|
+
function handleChange(event) {
|
|
126
|
+
const isNight = event.matches;
|
|
127
|
+
setSystemColorMode(matchesMediaToColorMode(isNight));
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
131
|
+
if (media) {
|
|
132
|
+
// just in case the preference changed before the event listener was attached
|
|
133
|
+
const isNight = media.matches;
|
|
134
|
+
setSystemColorMode(matchesMediaToColorMode(isNight));
|
|
135
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
136
|
+
if (media.addEventListener !== undefined) {
|
|
137
|
+
media.addEventListener('change', handleChange);
|
|
138
|
+
return function cleanup() {
|
|
139
|
+
media.removeEventListener('change', handleChange);
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
143
|
+
else if (media.addListener !== undefined) {
|
|
144
|
+
media.addListener(handleChange);
|
|
145
|
+
return function cleanup() {
|
|
146
|
+
media.removeListener(handleChange);
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}, []);
|
|
151
|
+
return systemColorMode;
|
|
152
|
+
}
|
|
153
|
+
function getSystemColorMode() {
|
|
154
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
155
|
+
if (typeof window !== 'undefined' && window.matchMedia?.('(prefers-color-scheme: dark)')?.matches) {
|
|
156
|
+
return 'night';
|
|
157
|
+
}
|
|
158
|
+
return 'day';
|
|
159
|
+
}
|
|
160
|
+
function resolveColorMode(colorMode, systemColorMode) {
|
|
161
|
+
switch (colorMode) {
|
|
162
|
+
case 'auto':
|
|
163
|
+
return systemColorMode;
|
|
164
|
+
default:
|
|
165
|
+
return colorMode;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
function chooseColorScheme(colorMode, dayScheme, nightScheme) {
|
|
169
|
+
switch (colorMode) {
|
|
170
|
+
case 'day':
|
|
171
|
+
case 'light':
|
|
172
|
+
return dayScheme;
|
|
173
|
+
case 'dark':
|
|
174
|
+
case 'night':
|
|
175
|
+
return nightScheme;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
function applyColorScheme(theme, colorScheme) {
|
|
179
|
+
if (!theme.colorSchemes) {
|
|
180
|
+
return {
|
|
181
|
+
resolvedTheme: theme,
|
|
182
|
+
resolvedColorScheme: undefined
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
if (!theme.colorSchemes[colorScheme]) {
|
|
186
|
+
// eslint-disable-next-line no-console
|
|
187
|
+
console.error(`\`${colorScheme}\` scheme not defined in \`theme.colorSchemes\``);
|
|
188
|
+
|
|
189
|
+
// Apply the first defined color scheme
|
|
190
|
+
const defaultColorScheme = Object.keys(theme.colorSchemes)[0];
|
|
191
|
+
return {
|
|
192
|
+
resolvedTheme: deepmerge(theme, theme.colorSchemes[defaultColorScheme]),
|
|
193
|
+
resolvedColorScheme: defaultColorScheme
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
return {
|
|
197
|
+
resolvedTheme: deepmerge(theme, theme.colorSchemes[colorScheme]),
|
|
198
|
+
resolvedColorScheme: colorScheme
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export { ThemeProvider, ThemeProvider as default, defaultColorMode, useColorSchemeVar, useTheme };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type TimelineProps as PrimerTimelineProps, type TimelineItemProps as PrimerTimelineItemProps, type TimelineBadgeProps as PrimerTimelineBadgeProps, type TimelineBodyProps as PrimerTimelineBodyProps, type TimelineBreakProps as PrimerTimelineBreakProps } from '@primer/react';
|
|
2
|
+
import { type SxProp } from '../sx';
|
|
3
|
+
export type TimelineProps = PrimerTimelineProps & SxProp;
|
|
4
|
+
export type TimelineItemProps = PrimerTimelineItemProps & SxProp;
|
|
5
|
+
export type TimelineBadgeProps = PrimerTimelineBadgeProps & SxProp;
|
|
6
|
+
export type TimelineBodyProps = PrimerTimelineBodyProps & SxProp;
|
|
7
|
+
export type TimelineBreakProps = PrimerTimelineBreakProps & SxProp;
|
|
8
|
+
declare function TimelineBadge(props: TimelineBadgeProps): import("react").JSX.Element;
|
|
9
|
+
export declare const Timeline: import("react").ForwardRefExoticComponent<{
|
|
10
|
+
clipSidebar?: boolean;
|
|
11
|
+
className?: string;
|
|
12
|
+
} & Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & SxProp & import("react").RefAttributes<HTMLDivElement>> & {
|
|
13
|
+
Item: import("react").ForwardRefExoticComponent<{
|
|
14
|
+
condensed?: boolean;
|
|
15
|
+
className?: string;
|
|
16
|
+
} & Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & SxProp & import("react").RefAttributes<HTMLDivElement>>;
|
|
17
|
+
Badge: typeof TimelineBadge;
|
|
18
|
+
Body: import("react").ForwardRefExoticComponent<{
|
|
19
|
+
className?: string;
|
|
20
|
+
} & Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & SxProp & import("react").RefAttributes<HTMLDivElement>>;
|
|
21
|
+
Break: import("react").ForwardRefExoticComponent<{
|
|
22
|
+
className?: string;
|
|
23
|
+
} & Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & SxProp & import("react").RefAttributes<HTMLDivElement>>;
|
|
24
|
+
};
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=Timeline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Timeline.d.ts","sourceRoot":"","sources":["../../src/components/Timeline.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,aAAa,IAAI,mBAAmB,EACzC,KAAK,iBAAiB,IAAI,uBAAuB,EACjD,KAAK,kBAAkB,IAAI,wBAAwB,EACnD,KAAK,iBAAiB,IAAI,uBAAuB,EACjD,KAAK,kBAAkB,IAAI,wBAAwB,EACpD,MAAM,eAAe,CAAA;AAGtB,OAAO,EAAC,KAAK,MAAM,EAAC,MAAM,OAAO,CAAA;AAEjC,MAAM,MAAM,aAAa,GAAG,mBAAmB,GAAG,MAAM,CAAA;AACxD,MAAM,MAAM,iBAAiB,GAAG,uBAAuB,GAAG,MAAM,CAAA;AAChE,MAAM,MAAM,kBAAkB,GAAG,wBAAwB,GAAG,MAAM,CAAA;AAClE,MAAM,MAAM,iBAAiB,GAAG,uBAAuB,GAAG,MAAM,CAAA;AAChE,MAAM,MAAM,kBAAkB,GAAG,wBAAwB,GAAG,MAAM,CAAA;AAUlE,iBAAS,aAAa,CAAC,KAAK,EAAE,kBAAkB,+BAE/C;AAUD,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;CAKnB,CAAA"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Timeline as Timeline$1 } from '@primer/react';
|
|
2
|
+
import Box from './Box.js';
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import { jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
const TimelineImpl = /*#__PURE__*/forwardRef(function Timeline(props, ref) {
|
|
7
|
+
return /*#__PURE__*/jsx(Box, {
|
|
8
|
+
as: Timeline$1,
|
|
9
|
+
ref: ref,
|
|
10
|
+
...props
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
const TimelineItem = /*#__PURE__*/forwardRef(function TimelineItem(props, ref) {
|
|
14
|
+
return /*#__PURE__*/jsx(Box, {
|
|
15
|
+
as: Timeline$1.Item,
|
|
16
|
+
ref: ref,
|
|
17
|
+
...props
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
function TimelineBadge(props) {
|
|
21
|
+
return /*#__PURE__*/jsx(Box, {
|
|
22
|
+
as: Timeline$1.Badge,
|
|
23
|
+
...props
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
const TimelineBody = /*#__PURE__*/forwardRef(function TimelineBody(props, ref) {
|
|
27
|
+
return /*#__PURE__*/jsx(Box, {
|
|
28
|
+
as: Timeline$1.Body,
|
|
29
|
+
ref: ref,
|
|
30
|
+
...props
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
const TimelineBreak = /*#__PURE__*/forwardRef(function TimelineBreak(props, ref) {
|
|
34
|
+
return /*#__PURE__*/jsx(Box, {
|
|
35
|
+
as: Timeline$1.Break,
|
|
36
|
+
ref: ref,
|
|
37
|
+
...props
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
const Timeline = Object.assign(TimelineImpl, {
|
|
41
|
+
Item: TimelineItem,
|
|
42
|
+
Badge: TimelineBadge,
|
|
43
|
+
Body: TimelineBody,
|
|
44
|
+
Break: TimelineBreak
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
export { Timeline };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type ToggleSwitchProps as PrimerToggleSwitchProps } from '@primer/react';
|
|
2
|
+
import type { StyledProps } from '../styled-props';
|
|
3
|
+
type ToggleSwitchProps = PrimerToggleSwitchProps & Omit<StyledProps, keyof PrimerToggleSwitchProps>;
|
|
4
|
+
declare const ToggleSwitch: import("react").ForwardRefExoticComponent<PrimerToggleSwitchProps & Omit<StyledProps, keyof PrimerToggleSwitchProps> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
5
|
+
export { ToggleSwitch, type ToggleSwitchProps };
|
|
6
|
+
//# sourceMappingURL=ToggleSwitch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToggleSwitch.d.ts","sourceRoot":"","sources":["../../src/components/ToggleSwitch.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqC,KAAK,iBAAiB,IAAI,uBAAuB,EAAC,MAAM,eAAe,CAAA;AAGnH,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,iBAAiB,CAAA;AAEhD,KAAK,iBAAiB,GAAG,uBAAuB,GAAG,IAAI,CAAC,WAAW,EAAE,MAAM,uBAAuB,CAAC,CAAA;AAEnG,QAAA,MAAM,YAAY,0KAEhB,CAAA;AAEF,OAAO,EAAC,YAAY,EAAE,KAAK,iBAAiB,EAAC,CAAA"}
|