@noya-app/noya-designsystem 0.1.24 → 0.1.25
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/.turbo/turbo-build.log +9 -9
- package/CHANGELOG.md +6 -0
- package/dist/index.d.mts +6 -2
- package/dist/index.d.ts +6 -2
- package/dist/index.js +89 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +89 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/Chip.tsx +14 -9
- package/src/components/InputField.tsx +34 -0
- package/src/components/ListView.tsx +33 -8
- package/src/components/SelectMenu.tsx +31 -2
- package/src/components/Switch.tsx +3 -0
package/dist/index.mjs
CHANGED
|
@@ -2240,6 +2240,35 @@ function InputFieldRoot({
|
|
|
2240
2240
|
measuredWidth && /* @__PURE__ */ React18.createElement(Stack.V, { width: measuredWidth, overflow: "hidden" }, renderPopoverContent({ width: measuredWidth }))
|
|
2241
2241
|
) : rootElement);
|
|
2242
2242
|
}
|
|
2243
|
+
var PrimitiveInputField = styled12.input(({ theme, readOnly, disabled }) => {
|
|
2244
|
+
return {
|
|
2245
|
+
// placeholder
|
|
2246
|
+
"&::placeholder": {
|
|
2247
|
+
color: theme.colors.textDisabled
|
|
2248
|
+
},
|
|
2249
|
+
...theme.textStyles.small,
|
|
2250
|
+
color: readOnly ? theme.colors.textMuted : disabled ? theme.colors.textDisabled : theme.colors.text,
|
|
2251
|
+
width: "0px",
|
|
2252
|
+
// Reset intrinsic width
|
|
2253
|
+
flex: "1 1 0px",
|
|
2254
|
+
position: "relative",
|
|
2255
|
+
border: "0",
|
|
2256
|
+
outline: "none",
|
|
2257
|
+
minWidth: "0",
|
|
2258
|
+
alignSelf: "stretch",
|
|
2259
|
+
borderRadius: "4px",
|
|
2260
|
+
paddingTop: "4px",
|
|
2261
|
+
paddingBottom: "4px",
|
|
2262
|
+
paddingLeft: "6px",
|
|
2263
|
+
paddingRight: "6px",
|
|
2264
|
+
background: theme.colors.inputBackground,
|
|
2265
|
+
"&:focus": {
|
|
2266
|
+
boxShadow: `0 0 0 2px ${theme.colors.primary}`
|
|
2267
|
+
},
|
|
2268
|
+
userSelect: "all",
|
|
2269
|
+
pointerEvents: "all"
|
|
2270
|
+
};
|
|
2271
|
+
});
|
|
2243
2272
|
var InputField;
|
|
2244
2273
|
((InputField2) => {
|
|
2245
2274
|
InputField2.Root = memo9(InputFieldRoot);
|
|
@@ -2249,6 +2278,7 @@ var InputField;
|
|
|
2249
2278
|
InputField2.DropdownMenu = InputFieldDropdownMenu;
|
|
2250
2279
|
InputField2.Button = InputFieldButton;
|
|
2251
2280
|
InputField2.Label = InputFieldLabel;
|
|
2281
|
+
InputField2.PrimitiveElement = PrimitiveInputField;
|
|
2252
2282
|
})(InputField || (InputField = {}));
|
|
2253
2283
|
|
|
2254
2284
|
// src/contexts/DialogContext.tsx
|
|
@@ -2594,9 +2624,12 @@ var ChipElement = styled14.span(({ theme, $colorScheme, $size, $variant, $monosp
|
|
|
2594
2624
|
// lineHeight: "1.4",
|
|
2595
2625
|
lineHeight: "15px",
|
|
2596
2626
|
whiteSpace: "pre",
|
|
2597
|
-
...$size === "
|
|
2627
|
+
...$size === "large" ? {
|
|
2598
2628
|
fontSize: "11px",
|
|
2599
2629
|
padding: "4px 8px"
|
|
2630
|
+
} : $size === "medium" ? {
|
|
2631
|
+
fontSize: "10px",
|
|
2632
|
+
padding: "2px 6px"
|
|
2600
2633
|
} : {
|
|
2601
2634
|
fontSize: "9px",
|
|
2602
2635
|
padding: "0px 4px"
|
|
@@ -2631,7 +2664,7 @@ var DeleteElement = styled14(Cross1Icon)(({ size: size2 }) => ({
|
|
|
2631
2664
|
marginRight: "-2px",
|
|
2632
2665
|
cursor: "pointer",
|
|
2633
2666
|
opacity: 0.5,
|
|
2634
|
-
...size2 === "
|
|
2667
|
+
...size2 === "large" ? {
|
|
2635
2668
|
marginLeft: "2px",
|
|
2636
2669
|
// top: '-1px',
|
|
2637
2670
|
transform: "scale(0.75)"
|
|
@@ -2650,7 +2683,7 @@ var AddElement = styled14(PlusIcon).withConfig({
|
|
|
2650
2683
|
marginLeft: "-2px",
|
|
2651
2684
|
cursor: "pointer",
|
|
2652
2685
|
opacity: 0.5,
|
|
2653
|
-
...size2 === "
|
|
2686
|
+
...size2 === "large" ? {
|
|
2654
2687
|
marginRight: "2px",
|
|
2655
2688
|
top: "-1px",
|
|
2656
2689
|
transform: "scale(0.75)"
|
|
@@ -2670,7 +2703,7 @@ var Chip = memo11(
|
|
|
2670
2703
|
addable,
|
|
2671
2704
|
clickable,
|
|
2672
2705
|
style: style3,
|
|
2673
|
-
size: size2 = "
|
|
2706
|
+
size: size2 = "large",
|
|
2674
2707
|
variant = "solid",
|
|
2675
2708
|
monospace = false,
|
|
2676
2709
|
tabIndex,
|
|
@@ -4581,9 +4614,10 @@ var Sortable;
|
|
|
4581
4614
|
// src/components/ListView.tsx
|
|
4582
4615
|
var ROW_HEIGHT = 31;
|
|
4583
4616
|
var SECTION_HEADER_LABEL_HEIGHT = 27;
|
|
4584
|
-
var
|
|
4617
|
+
var ListViewDraggingContext = createContext9({
|
|
4585
4618
|
indentation: 12
|
|
4586
4619
|
});
|
|
4620
|
+
ListViewDraggingContext.displayName = "ListViewDraggingContext";
|
|
4587
4621
|
var ListRowContext = createContext9({
|
|
4588
4622
|
marginType: "none",
|
|
4589
4623
|
selectedPosition: "only",
|
|
@@ -4597,6 +4631,7 @@ var ListRowContext = createContext9({
|
|
|
4597
4631
|
isSectionHeader: false,
|
|
4598
4632
|
colorScheme: "primary"
|
|
4599
4633
|
});
|
|
4634
|
+
ListRowContext.displayName = "ListRowContext";
|
|
4600
4635
|
var ListViewRowTitle = styled23.span(({ theme }) => ({
|
|
4601
4636
|
flex: "1 1 0",
|
|
4602
4637
|
overflow: "hidden",
|
|
@@ -4784,7 +4819,7 @@ var ListViewRow = forwardRef13(function ListViewRow2({
|
|
|
4784
4819
|
const { hoverProps } = useHover({
|
|
4785
4820
|
onHoverChange
|
|
4786
4821
|
});
|
|
4787
|
-
const { indentation, isDragging } = useContext9(
|
|
4822
|
+
const { indentation, isDragging } = useContext9(ListViewDraggingContext);
|
|
4788
4823
|
const handlePress = useCallback20(
|
|
4789
4824
|
(event) => {
|
|
4790
4825
|
event.preventDefault();
|
|
@@ -4886,6 +4921,7 @@ var ListViewRow = forwardRef13(function ListViewRow2({
|
|
|
4886
4921
|
var RenderItemContext = createContext9(
|
|
4887
4922
|
() => null
|
|
4888
4923
|
);
|
|
4924
|
+
RenderItemContext.displayName = "RenderItemContext";
|
|
4889
4925
|
var VirtualizedListRow = memo22(function VirtualizedListRow2({
|
|
4890
4926
|
index,
|
|
4891
4927
|
style: style3
|
|
@@ -5010,8 +5046,26 @@ var ListViewRootInner = forwardRef13(function ListViewRootInner2({
|
|
|
5010
5046
|
(index) => renderItem(data[index], index, { isDragging: false }),
|
|
5011
5047
|
[data, renderItem]
|
|
5012
5048
|
);
|
|
5049
|
+
const defaultContextValue = useMemo18(
|
|
5050
|
+
() => ({
|
|
5051
|
+
colorScheme,
|
|
5052
|
+
marginType: "none",
|
|
5053
|
+
selectedPosition: "only",
|
|
5054
|
+
sortable,
|
|
5055
|
+
expandable,
|
|
5056
|
+
divider,
|
|
5057
|
+
pressEventName,
|
|
5058
|
+
variant,
|
|
5059
|
+
gap,
|
|
5060
|
+
sectionHeaderVariant: "normal",
|
|
5061
|
+
isSectionHeader: false
|
|
5062
|
+
}),
|
|
5063
|
+
[colorScheme, sortable, expandable, divider, pressEventName, variant, gap]
|
|
5064
|
+
);
|
|
5013
5065
|
const getItemContextValue = useCallback20(
|
|
5014
5066
|
(i) => {
|
|
5067
|
+
if (variant === "bare" || variant === "normal")
|
|
5068
|
+
return defaultContextValue;
|
|
5015
5069
|
const current = renderChild(i);
|
|
5016
5070
|
if (!isValidElement3(current))
|
|
5017
5071
|
return;
|
|
@@ -5058,6 +5112,8 @@ var ListViewRootInner = forwardRef13(function ListViewRootInner2({
|
|
|
5058
5112
|
};
|
|
5059
5113
|
},
|
|
5060
5114
|
[
|
|
5115
|
+
variant,
|
|
5116
|
+
defaultContextValue,
|
|
5061
5117
|
renderChild,
|
|
5062
5118
|
data.length,
|
|
5063
5119
|
colorScheme,
|
|
@@ -5065,7 +5121,6 @@ var ListViewRootInner = forwardRef13(function ListViewRootInner2({
|
|
|
5065
5121
|
expandable,
|
|
5066
5122
|
divider,
|
|
5067
5123
|
pressEventName,
|
|
5068
|
-
variant,
|
|
5069
5124
|
sectionHeaderVariant,
|
|
5070
5125
|
gap
|
|
5071
5126
|
]
|
|
@@ -5075,7 +5130,7 @@ var ListViewRootInner = forwardRef13(function ListViewRootInner2({
|
|
|
5075
5130
|
[indentation]
|
|
5076
5131
|
);
|
|
5077
5132
|
const renderOverlay = useCallback20(
|
|
5078
|
-
(index) => /* @__PURE__ */ React35.createElement("div", { style: { opacity: 0.25 } }, /* @__PURE__ */ React35.createElement(
|
|
5133
|
+
(index) => /* @__PURE__ */ React35.createElement("div", { style: { opacity: 0.25 } }, /* @__PURE__ */ React35.createElement(ListViewDraggingContext.Provider, { value: draggingContextOverlayValue }, renderItem(data[index], index, { isDragging: true }))),
|
|
5079
5134
|
[draggingContextOverlayValue, renderItem, data]
|
|
5080
5135
|
);
|
|
5081
5136
|
const renderWrappedChild = useCallback20(
|
|
@@ -5114,7 +5169,7 @@ var ListViewRootInner = forwardRef13(function ListViewRootInner2({
|
|
|
5114
5169
|
[data, keyExtractor]
|
|
5115
5170
|
);
|
|
5116
5171
|
const draggingContextValue = useMemo18(() => ({ indentation }), [indentation]);
|
|
5117
|
-
return /* @__PURE__ */ React35.createElement(
|
|
5172
|
+
return /* @__PURE__ */ React35.createElement(ListViewDraggingContext.Provider, { value: draggingContextValue }, /* @__PURE__ */ React35.createElement(
|
|
5118
5173
|
RootContainer2,
|
|
5119
5174
|
{
|
|
5120
5175
|
id,
|
|
@@ -6117,6 +6172,10 @@ import { DropdownChevronIcon } from "@noya-app/noya-icons";
|
|
|
6117
6172
|
import * as Select3 from "@radix-ui/react-select";
|
|
6118
6173
|
import React44, { memo as memo29 } from "react";
|
|
6119
6174
|
import { styled as styled31 } from "styled-components";
|
|
6175
|
+
var readOnlyStyle = {
|
|
6176
|
+
justifyContent: "flex-start",
|
|
6177
|
+
textAlign: "left"
|
|
6178
|
+
};
|
|
6120
6179
|
var SelectMenu = memo29(function SelectMenu2({
|
|
6121
6180
|
id,
|
|
6122
6181
|
style: style3,
|
|
@@ -6124,13 +6183,29 @@ var SelectMenu = memo29(function SelectMenu2({
|
|
|
6124
6183
|
menuItems,
|
|
6125
6184
|
value,
|
|
6126
6185
|
onSelect,
|
|
6127
|
-
placeholder
|
|
6186
|
+
placeholder,
|
|
6187
|
+
disabled,
|
|
6188
|
+
readOnly
|
|
6128
6189
|
}) {
|
|
6129
6190
|
const selectedItem = menuItems.find(
|
|
6130
6191
|
(item) => typeof item !== "string" && item.value === value
|
|
6131
6192
|
);
|
|
6132
6193
|
const icon = selectedItem?.icon;
|
|
6133
|
-
|
|
6194
|
+
if (readOnly) {
|
|
6195
|
+
return /* @__PURE__ */ React44.createElement(
|
|
6196
|
+
Button,
|
|
6197
|
+
{
|
|
6198
|
+
id,
|
|
6199
|
+
style: style3,
|
|
6200
|
+
contentStyle: readOnlyStyle,
|
|
6201
|
+
className,
|
|
6202
|
+
disabled
|
|
6203
|
+
},
|
|
6204
|
+
icon && /* @__PURE__ */ React44.createElement(React44.Fragment, null, renderIcon(icon), /* @__PURE__ */ React44.createElement(Spacer.Horizontal, { size: 8 })),
|
|
6205
|
+
selectedItem?.title ?? value
|
|
6206
|
+
);
|
|
6207
|
+
}
|
|
6208
|
+
return /* @__PURE__ */ React44.createElement(Select3.Root, { value, onValueChange: onSelect }, /* @__PURE__ */ React44.createElement(Select3.SelectTrigger, { asChild: true }, /* @__PURE__ */ React44.createElement(Button, { id, style: style3, className, disabled }, icon && /* @__PURE__ */ React44.createElement(React44.Fragment, null, renderIcon(icon), /* @__PURE__ */ React44.createElement(Spacer.Horizontal, { size: 8 })), /* @__PURE__ */ React44.createElement(Select3.Value, { placeholder }), /* @__PURE__ */ React44.createElement(Spacer.Horizontal, null), /* @__PURE__ */ React44.createElement(DropdownChevronIcon, null))), /* @__PURE__ */ React44.createElement(Select3.Portal, null, /* @__PURE__ */ React44.createElement(SelectContent, null, /* @__PURE__ */ React44.createElement(SelectViewport, null, menuItems.map((menuItem) => {
|
|
6134
6209
|
if (typeof menuItem === "string") {
|
|
6135
6210
|
return /* @__PURE__ */ React44.createElement(StyledSeparator, null);
|
|
6136
6211
|
}
|
|
@@ -6254,13 +6329,15 @@ var SwitchThumb = styled33(SwitchPrimitive.Thumb)({
|
|
|
6254
6329
|
var Switch = function Switch2({
|
|
6255
6330
|
value,
|
|
6256
6331
|
onChange,
|
|
6257
|
-
colorScheme = "normal"
|
|
6332
|
+
colorScheme = "normal",
|
|
6333
|
+
disabled
|
|
6258
6334
|
}) {
|
|
6259
6335
|
return /* @__PURE__ */ React46.createElement(
|
|
6260
6336
|
SwitchRoot,
|
|
6261
6337
|
{
|
|
6262
6338
|
$colorScheme: colorScheme,
|
|
6263
6339
|
checked: value,
|
|
6340
|
+
disabled,
|
|
6264
6341
|
onCheckedChange: (newValue) => {
|
|
6265
6342
|
onChange(newValue);
|
|
6266
6343
|
}
|