@spark-web/text 1.2.0 → 2.0.0-rc.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 +26 -0
- package/dist/declarations/src/context.d.ts +2 -2
- package/dist/declarations/src/default-text-props.d.ts +3 -3
- package/dist/declarations/src/index.d.ts +11 -11
- package/dist/declarations/src/strong.d.ts +1 -1
- package/dist/declarations/src/text.d.ts +4 -4
- package/dist/declarations/src/use-text.d.ts +2 -2
- package/dist/spark-web-text.cjs.d.ts +1 -0
- package/dist/spark-web-text.cjs.dev.js +5 -5
- package/dist/spark-web-text.cjs.prod.js +5 -5
- package/dist/spark-web-text.esm.js +5 -5
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @spark-web/text
|
|
2
2
|
|
|
3
|
+
## 2.0.0-rc.1
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- rc
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies []:
|
|
12
|
+
- @spark-web/theme@4.0.0-rc.1
|
|
13
|
+
- @spark-web/utils@2.0.0-rc.1
|
|
14
|
+
- @spark-web/box@2.0.0-rc.1
|
|
15
|
+
|
|
16
|
+
## 2.0.0-rc.0
|
|
17
|
+
|
|
18
|
+
### Major Changes
|
|
19
|
+
|
|
20
|
+
- rc versio
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- Updated dependencies []:
|
|
25
|
+
- @spark-web/theme@4.0.0-rc.0
|
|
26
|
+
- @spark-web/box@2.0.0-rc.0
|
|
27
|
+
- @spark-web/utils@2.0.0-rc.0
|
|
28
|
+
|
|
3
29
|
## 1.2.0
|
|
4
30
|
|
|
5
31
|
### Minor Changes
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export declare const TextContext: import("react").Context<{
|
|
3
3
|
size: "small" | "xsmall" | "standard" | "large";
|
|
4
|
-
tone: "link" | "
|
|
4
|
+
tone: "link" | "disabled" | "muted" | "fieldAccent" | "accent" | "neutral" | "primary" | "secondary" | "caution" | "critical" | "info" | "positive" | "placeholder" | "primaryHover" | "primaryActive" | "secondaryHover" | "secondaryActive";
|
|
5
5
|
weight: "regular" | "semibold";
|
|
6
6
|
} | undefined>;
|
|
7
7
|
export declare function useTextContext(): {
|
|
8
8
|
size: "small" | "xsmall" | "standard" | "large";
|
|
9
|
-
tone: "link" | "
|
|
9
|
+
tone: "link" | "disabled" | "muted" | "fieldAccent" | "accent" | "neutral" | "primary" | "secondary" | "caution" | "critical" | "info" | "positive" | "placeholder" | "primaryHover" | "primaryActive" | "secondaryHover" | "secondaryActive";
|
|
10
10
|
weight: "regular" | "semibold";
|
|
11
11
|
} | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
-
import type { UseTextProps } from
|
|
2
|
+
import type { UseTextProps } from "./use-text.js";
|
|
3
3
|
declare type DefaultTextProps = {
|
|
4
4
|
size?: NonNullable<UseTextProps['size']>;
|
|
5
5
|
tone?: NonNullable<UseTextProps['tone']>;
|
|
@@ -7,10 +7,10 @@ declare type DefaultTextProps = {
|
|
|
7
7
|
};
|
|
8
8
|
export declare function DefaultTextPropsProvider({ children, size, tone, weight, }: DefaultTextProps & {
|
|
9
9
|
children: ReactNode;
|
|
10
|
-
}): JSX.Element;
|
|
10
|
+
}): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
11
11
|
export declare const useDefaultTextProps: ({ size: sizeProp, tone: toneProp, weight: weightProp, }: DefaultTextProps) => {
|
|
12
12
|
size: "small" | "xsmall" | "standard" | "large";
|
|
13
|
-
tone: "link" | "
|
|
13
|
+
tone: "link" | "disabled" | "muted" | "fieldAccent" | "accent" | "neutral" | "primary" | "secondary" | "caution" | "critical" | "info" | "positive" | "placeholder" | "primaryHover" | "primaryActive" | "secondaryHover" | "secondaryActive";
|
|
14
14
|
weight: "regular" | "semibold";
|
|
15
15
|
};
|
|
16
16
|
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export { useTextContext } from
|
|
2
|
-
export { DefaultTextPropsProvider, useDefaultTextProps, } from
|
|
3
|
-
export { Strong } from
|
|
4
|
-
export { Text } from
|
|
5
|
-
export { useForegroundTone } from
|
|
6
|
-
export { useOverflowStrategy } from
|
|
7
|
-
export { createTextStyles, useText } from
|
|
8
|
-
export type { StrongProps } from
|
|
9
|
-
export type { TextProps } from
|
|
10
|
-
export type { ForegroundTone } from
|
|
11
|
-
export type { TextOverflowStrategy } from
|
|
1
|
+
export { useTextContext } from "./context.js";
|
|
2
|
+
export { DefaultTextPropsProvider, useDefaultTextProps, } from "./default-text-props.js";
|
|
3
|
+
export { Strong } from "./strong.js";
|
|
4
|
+
export { Text } from "./text.js";
|
|
5
|
+
export { useForegroundTone } from "./use-foreground-tone.js";
|
|
6
|
+
export { useOverflowStrategy } from "./use-overflow-strategy.js";
|
|
7
|
+
export { createTextStyles, useText } from "./use-text.js";
|
|
8
|
+
export type { StrongProps } from "./strong.js";
|
|
9
|
+
export type { TextProps } from "./text.js";
|
|
10
|
+
export type { ForegroundTone } from "./use-foreground-tone.js";
|
|
11
|
+
export type { TextOverflowStrategy } from "./use-overflow-strategy.js";
|
|
@@ -2,4 +2,4 @@ import type { ReactNode } from 'react';
|
|
|
2
2
|
export declare type StrongProps = {
|
|
3
3
|
children: ReactNode;
|
|
4
4
|
};
|
|
5
|
-
export declare const Strong: ({ children }: StrongProps) => JSX.Element;
|
|
5
|
+
export declare const Strong: ({ children }: StrongProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { BoxProps } from '@spark-web/box';
|
|
2
2
|
import type { DataAttributeMap } from '@spark-web/utils/internal';
|
|
3
3
|
import type { CSSProperties, ReactNode } from 'react';
|
|
4
|
-
import type { TextOverflowStrategy } from
|
|
5
|
-
import type { UseTextProps } from
|
|
4
|
+
import type { TextOverflowStrategy } from "./use-overflow-strategy.js";
|
|
5
|
+
import type { UseTextProps } from "./use-text.js";
|
|
6
6
|
declare type InlineProps = {
|
|
7
7
|
align?: never;
|
|
8
8
|
/** Display as an inline element. */
|
|
@@ -28,8 +28,8 @@ export declare type TextProps = Partial<UseTextProps> & {
|
|
|
28
28
|
/** Transform the text casing. */
|
|
29
29
|
transform?: CSSProperties['textTransform'];
|
|
30
30
|
} & (InlineProps | BlockProps);
|
|
31
|
-
export declare const Text: <Comp extends import("react").ElementType<any> = "div">(props: {
|
|
31
|
+
export declare const Text: <Comp extends import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> = "div">(props: {
|
|
32
32
|
as?: Comp | undefined;
|
|
33
|
-
ref?: import("react").Ref<Comp extends "symbol" | "clipPath" | "filter" | "mask" | "marker" | "svg" | "animate" | "animateMotion" | "animateTransform" | "circle" | "defs" | "desc" | "ellipse" | "feBlend" | "feColorMatrix" | "feComponentTransfer" | "feComposite" | "feConvolveMatrix" | "feDiffuseLighting" | "feDisplacementMap" | "feDistantLight" | "feDropShadow" | "feFlood" | "feFuncA" | "feFuncB" | "feFuncG" | "feFuncR" | "feGaussianBlur" | "feImage" | "feMerge" | "feMergeNode" | "feMorphology" | "feOffset" | "fePointLight" | "feSpecularLighting" | "feSpotLight" | "feTile" | "feTurbulence" | "foreignObject" | "g" | "image" | "line" | "linearGradient" | "metadata" | "mpath" | "path" | "pattern" | "polygon" | "polyline" | "radialGradient" | "rect" | "stop" | "switch" | "text" | "textPath" | "tspan" | "use" | "view" | keyof HTMLElementTagNameMap
|
|
33
|
+
ref?: import("react").Ref<Comp extends "symbol" | "clipPath" | "filter" | "mask" | "marker" | "svg" | "animate" | "animateMotion" | "animateTransform" | "circle" | "defs" | "desc" | "ellipse" | "feBlend" | "feColorMatrix" | "feComponentTransfer" | "feComposite" | "feConvolveMatrix" | "feDiffuseLighting" | "feDisplacementMap" | "feDistantLight" | "feDropShadow" | "feFlood" | "feFuncA" | "feFuncB" | "feFuncG" | "feFuncR" | "feGaussianBlur" | "feImage" | "feMerge" | "feMergeNode" | "feMorphology" | "feOffset" | "fePointLight" | "feSpecularLighting" | "feSpotLight" | "feTile" | "feTurbulence" | "foreignObject" | "g" | "image" | "line" | "linearGradient" | "metadata" | "mpath" | "path" | "pattern" | "polygon" | "polyline" | "radialGradient" | "rect" | "set" | "stop" | "switch" | "text" | "textPath" | "tspan" | "use" | "view" | keyof HTMLElementTagNameMap ? (HTMLElementTagNameMap & Pick<SVGElementTagNameMap, "symbol" | "clipPath" | "filter" | "mask" | "marker" | "svg" | "animate" | "animateMotion" | "animateTransform" | "circle" | "defs" | "desc" | "ellipse" | "feBlend" | "feColorMatrix" | "feComponentTransfer" | "feComposite" | "feConvolveMatrix" | "feDiffuseLighting" | "feDisplacementMap" | "feDistantLight" | "feDropShadow" | "feFlood" | "feFuncA" | "feFuncB" | "feFuncG" | "feFuncR" | "feGaussianBlur" | "feImage" | "feMerge" | "feMergeNode" | "feMorphology" | "feOffset" | "fePointLight" | "feSpecularLighting" | "feSpotLight" | "feTile" | "feTurbulence" | "foreignObject" | "g" | "image" | "line" | "linearGradient" | "metadata" | "mpath" | "path" | "pattern" | "polygon" | "polyline" | "radialGradient" | "rect" | "set" | "stop" | "switch" | "text" | "textPath" | "tspan" | "use" | "view">)[Comp] : Comp extends new (...args: any) => any ? InstanceType<Comp> : undefined> | undefined;
|
|
34
34
|
} & Omit<import("react").PropsWithoutRef<import("react").ComponentProps<Comp>>, "as"> & TextProps) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
35
35
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BrighteTextDefinition, BrighteTheme } from '@spark-web/theme';
|
|
2
|
-
import type { ForegroundTone } from
|
|
2
|
+
import type { ForegroundTone } from "./use-foreground-tone.js";
|
|
3
3
|
export declare type UseTextProps = {
|
|
4
4
|
/** Apply leading-trim styles. */
|
|
5
5
|
baseline?: boolean;
|
|
@@ -10,7 +10,7 @@ export declare type UseTextProps = {
|
|
|
10
10
|
/** The weight of the text. */
|
|
11
11
|
weight: keyof BrighteTheme['typography']['fontWeight'];
|
|
12
12
|
};
|
|
13
|
-
export declare function useText({ baseline, size, tone, weight }: UseTextProps):
|
|
13
|
+
export declare function useText({ baseline, size, tone, weight }: UseTextProps): any[];
|
|
14
14
|
export declare function createTextStyles({ fontSize, lineHeight, trims }: BrighteTextDefinition, { includeTrims }?: {
|
|
15
15
|
includeTrims?: boolean | undefined;
|
|
16
16
|
}): {
|
|
@@ -1 +1,2 @@
|
|
|
1
1
|
export * from "./declarations/src/index";
|
|
2
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3Bhcmstd2ViLXRleHQuY2pzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuL2RlY2xhcmF0aW9ucy9zcmMvaW5kZXguZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSJ9
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var react = require('react');
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
-
var
|
|
7
|
+
var react$1 = require('@emotion/react');
|
|
8
8
|
var theme = require('@spark-web/theme');
|
|
9
9
|
var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
|
|
10
10
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
@@ -61,7 +61,7 @@ var Strong = function Strong(_ref) {
|
|
|
61
61
|
fontWeight: theme$1.typography.fontWeight.semibold
|
|
62
62
|
};
|
|
63
63
|
return /*#__PURE__*/jsxRuntime.jsx("strong", {
|
|
64
|
-
|
|
64
|
+
css: react$1.css(styles),
|
|
65
65
|
children: children
|
|
66
66
|
});
|
|
67
67
|
};
|
|
@@ -212,14 +212,14 @@ var Text = ts.forwardRefWithAs(function (_ref, forwardedRef) {
|
|
|
212
212
|
data: data,
|
|
213
213
|
ref: forwardedRef,
|
|
214
214
|
id: id,
|
|
215
|
-
|
|
215
|
+
css: react$1.css(styles),
|
|
216
216
|
children: children
|
|
217
217
|
}));
|
|
218
218
|
}
|
|
219
219
|
|
|
220
220
|
// prepare block variant
|
|
221
221
|
var content = overflowStrategy ? /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
222
|
-
|
|
222
|
+
css: react$1.css(overflowStyles),
|
|
223
223
|
children: children
|
|
224
224
|
}) : children;
|
|
225
225
|
var textContextValue = react.useMemo(function () {
|
|
@@ -236,7 +236,7 @@ var Text = ts.forwardRefWithAs(function (_ref, forwardedRef) {
|
|
|
236
236
|
data: data,
|
|
237
237
|
ref: forwardedRef,
|
|
238
238
|
id: id,
|
|
239
|
-
|
|
239
|
+
css: react$1.css(styles),
|
|
240
240
|
children: content
|
|
241
241
|
}))
|
|
242
242
|
});
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var react = require('react');
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
-
var
|
|
7
|
+
var react$1 = require('@emotion/react');
|
|
8
8
|
var theme = require('@spark-web/theme');
|
|
9
9
|
var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
|
|
10
10
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
@@ -61,7 +61,7 @@ var Strong = function Strong(_ref) {
|
|
|
61
61
|
fontWeight: theme$1.typography.fontWeight.semibold
|
|
62
62
|
};
|
|
63
63
|
return /*#__PURE__*/jsxRuntime.jsx("strong", {
|
|
64
|
-
|
|
64
|
+
css: react$1.css(styles),
|
|
65
65
|
children: children
|
|
66
66
|
});
|
|
67
67
|
};
|
|
@@ -212,14 +212,14 @@ var Text = ts.forwardRefWithAs(function (_ref, forwardedRef) {
|
|
|
212
212
|
data: data,
|
|
213
213
|
ref: forwardedRef,
|
|
214
214
|
id: id,
|
|
215
|
-
|
|
215
|
+
css: react$1.css(styles),
|
|
216
216
|
children: children
|
|
217
217
|
}));
|
|
218
218
|
}
|
|
219
219
|
|
|
220
220
|
// prepare block variant
|
|
221
221
|
var content = overflowStrategy ? /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
222
|
-
|
|
222
|
+
css: react$1.css(overflowStyles),
|
|
223
223
|
children: children
|
|
224
224
|
}) : children;
|
|
225
225
|
var textContextValue = react.useMemo(function () {
|
|
@@ -236,7 +236,7 @@ var Text = ts.forwardRefWithAs(function (_ref, forwardedRef) {
|
|
|
236
236
|
data: data,
|
|
237
237
|
ref: forwardedRef,
|
|
238
238
|
id: id,
|
|
239
|
-
|
|
239
|
+
css: react$1.css(styles),
|
|
240
240
|
children: content
|
|
241
241
|
}))
|
|
242
242
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createContext, useContext, useMemo } from 'react';
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { css } from '@emotion/
|
|
3
|
+
import { css } from '@emotion/react';
|
|
4
4
|
import { useTheme } from '@spark-web/theme';
|
|
5
5
|
import _objectSpread from '@babel/runtime/helpers/esm/objectSpread2';
|
|
6
6
|
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
@@ -57,7 +57,7 @@ var Strong = function Strong(_ref) {
|
|
|
57
57
|
fontWeight: theme.typography.fontWeight.semibold
|
|
58
58
|
};
|
|
59
59
|
return /*#__PURE__*/jsx("strong", {
|
|
60
|
-
|
|
60
|
+
css: css(styles),
|
|
61
61
|
children: children
|
|
62
62
|
});
|
|
63
63
|
};
|
|
@@ -208,14 +208,14 @@ var Text = forwardRefWithAs(function (_ref, forwardedRef) {
|
|
|
208
208
|
data: data,
|
|
209
209
|
ref: forwardedRef,
|
|
210
210
|
id: id,
|
|
211
|
-
|
|
211
|
+
css: css(styles),
|
|
212
212
|
children: children
|
|
213
213
|
}));
|
|
214
214
|
}
|
|
215
215
|
|
|
216
216
|
// prepare block variant
|
|
217
217
|
var content = overflowStrategy ? /*#__PURE__*/jsx("span", {
|
|
218
|
-
|
|
218
|
+
css: css(overflowStyles),
|
|
219
219
|
children: children
|
|
220
220
|
}) : children;
|
|
221
221
|
var textContextValue = useMemo(function () {
|
|
@@ -232,7 +232,7 @@ var Text = forwardRefWithAs(function (_ref, forwardedRef) {
|
|
|
232
232
|
data: data,
|
|
233
233
|
ref: forwardedRef,
|
|
234
234
|
id: id,
|
|
235
|
-
|
|
235
|
+
css: css(styles),
|
|
236
236
|
children: content
|
|
237
237
|
}))
|
|
238
238
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spark-web/text",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-rc.1",
|
|
4
4
|
"homepage": "https://github.com/brighte-labs/spark-web#readme",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
"README.md"
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@babel/runtime": "^7.
|
|
19
|
-
"@emotion/
|
|
20
|
-
"@spark-web/box": "^
|
|
21
|
-
"@spark-web/theme": "^
|
|
22
|
-
"@spark-web/utils": "^
|
|
18
|
+
"@babel/runtime": "^7.25.0",
|
|
19
|
+
"@emotion/react": "^11.13.5",
|
|
20
|
+
"@spark-web/box": "^2.0.0-rc.1",
|
|
21
|
+
"@spark-web/theme": "^4.0.0-rc.1",
|
|
22
|
+
"@spark-web/utils": "^2.0.0-rc.1"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@types/react": "^18.2.0",
|