jvetrau-ds 0.2.7 → 0.2.9
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/components/flip-list/flip-list.cjs +29 -15
- package/components/flip-list/flip-list.cjs.map +1 -1
- package/components/flip-list/flip-list.css +64 -31
- package/components/flip-list/flip-list.d.ts +2 -0
- package/components/flip-list/flip-list.js +28 -15
- package/components/flip-list/flip-list.js.map +1 -1
- package/components/index.cjs +2 -2
- package/components/index.d.ts +4 -4
- package/components/index.js +2 -2
- package/components/input/input.cjs +12 -4
- package/components/input/input.cjs.map +1 -1
- package/components/input/input.css +16 -0
- package/components/input/input.d.ts +2 -0
- package/components/input/input.js +12 -4
- package/components/input/input.js.map +1 -1
- package/components/select/select.cjs +12 -4
- package/components/select/select.cjs.map +1 -1
- package/components/select/select.css +17 -1
- package/components/select/select.d.ts +2 -0
- package/components/select/select.js +12 -4
- package/components/select/select.js.map +1 -1
- package/components/textarea/textarea.cjs +68 -4
- package/components/textarea/textarea.cjs.map +1 -1
- package/components/textarea/textarea.css +25 -0
- package/components/textarea/textarea.d.ts +3 -0
- package/components/textarea/textarea.js +68 -4
- package/components/textarea/textarea.js.map +1 -1
- package/package.json +1 -1
- package/styles.css +122 -32
|
@@ -3,12 +3,14 @@
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
var React = require('react');
|
|
5
5
|
require('./flip-list.css');
|
|
6
|
+
var Icon = require('../../icons/icon');
|
|
6
7
|
var classnames = require('../helpers/classnames');
|
|
7
8
|
var Tag = require('../tag');
|
|
8
9
|
|
|
9
10
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
11
|
|
|
11
12
|
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
13
|
+
var Icon__default = /*#__PURE__*/_interopDefault(Icon);
|
|
12
14
|
var Tag__default = /*#__PURE__*/_interopDefault(Tag);
|
|
13
15
|
|
|
14
16
|
function hasContent(value) {
|
|
@@ -95,6 +97,7 @@ const FlipList = ({
|
|
|
95
97
|
const hasStatus = hasContent(
|
|
96
98
|
item.status
|
|
97
99
|
);
|
|
100
|
+
const statusIcon = item.statusIcon;
|
|
98
101
|
const hasMeta = hasContent(
|
|
99
102
|
item.meta
|
|
100
103
|
);
|
|
@@ -107,6 +110,16 @@ const FlipList = ({
|
|
|
107
110
|
"flip-list__item--open": isOpen
|
|
108
111
|
}
|
|
109
112
|
);
|
|
113
|
+
const resolvedStatusIcon = statusIcon !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
114
|
+
Icon__default.default,
|
|
115
|
+
{
|
|
116
|
+
name: statusIcon,
|
|
117
|
+
size: "base",
|
|
118
|
+
className: "flip-list__status-icon",
|
|
119
|
+
"aria-hidden": true,
|
|
120
|
+
focusable: false
|
|
121
|
+
}
|
|
122
|
+
) : null;
|
|
110
123
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
111
124
|
"div",
|
|
112
125
|
{
|
|
@@ -114,21 +127,22 @@ const FlipList = ({
|
|
|
114
127
|
className: itemClasses,
|
|
115
128
|
children: [
|
|
116
129
|
hasStatus && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flip-list__status", children: /* @__PURE__ */ jsxRuntime.jsx(Tag__default.default, { children: item.status }) }),
|
|
117
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "flip-list__title", children: item.title })
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
130
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flip-list__heading", children: [
|
|
131
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
132
|
+
"button",
|
|
133
|
+
{
|
|
134
|
+
className: "flip-list__trigger",
|
|
135
|
+
id: triggerId,
|
|
136
|
+
type: "button",
|
|
137
|
+
"aria-expanded": isOpen,
|
|
138
|
+
"aria-controls": contentId,
|
|
139
|
+
onClick: () => toggleItem(item.id),
|
|
140
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flip-list__title", children: item.title })
|
|
141
|
+
}
|
|
142
|
+
),
|
|
143
|
+
resolvedStatusIcon,
|
|
144
|
+
hasMeta && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flip-list__meta", children: item.meta })
|
|
145
|
+
] }),
|
|
132
146
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
133
147
|
"div",
|
|
134
148
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/flip-list/flip-list.tsx"],"names":["React","classnames","jsx","jsxs","Tag"],"mappings":";;;;;;;;;;;;;AAqEA,SAAS,WACP,KAAA,EAIA;AACA,EAAA,OAAO,KAAA,KAAU,QAAQ,KAAA,KAAU,MAAA;AACrC;AAEA,SAAS,mBAAA,CACP,OACA,MAAA,EACY;AACZ,EAAA,IACE,MAAA,KAAW,IAAA,IACX,MAAA,KAAW,MAAA,EACX;AACA,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,MAAM,kBAAkB,KAAA,CAAM,IAAA;AAAA,IAC5B,CAAC,IAAA,KAAS,IAAA,CAAK,EAAA,KAAO;AAAA,GACxB;AAEA,EAAA,OAAO,kBACH,MAAA,GACA,IAAA;AACN;AAEA,MAAM,WAAoC,CAAC;AAAA,EACzC,KAAA;AAAA,EACA,MAAA;AAAA,EACA,aAAA;AAAA,EACA,YAAA;AAAA,EACA,mBAAA,GAAsB,KAAA;AAAA,EACtB,SAAA,GAAY,EAAA;AAAA,EACZ,GAAG;AACL,CAAA,KAAM;AACJ,EAAA,MAAM,WAAA,GAAcA,uBAAM,KAAA,EAAM;AAEhC,EAAA,MAAM,eACJ,MAAA,KAAW,MAAA;AAEb,EAAA,MAAM,uBACJA,sBA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AA;AAAA,gBAAA;AAAA,kBACC,SAAA,EAAU,oBAAA;AAAA,kBACV,EAAA,EAAI,SAAA;AAAA,kBACJ,IAAA,EAAK,QAAA;AAAA,kBACL,eAAA,EAAe,MAAA;AAAA,kBACf,eAAA,EAAe,SAAA;AAAA,kBACf,OAAA,EAAS,MACP,UAAA,CAAW,IAAA,CAAK,EAAE,CAAA;AAAA,kBAGpB,QAAA,EAAA;AAAA,oCAAAD,cAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,kBAAA,EACb,QAAA,EAAA,IAAA,CAAK,KAAA,EACR,CAAA;AAAA,oBAEC,2BACCA,cAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,iBAAA,EACb,eAAK,IAAA,EACR;AAAA;AAAA;AAAA,eAEJ;AAAA,8BAEAA,cAAA;AAAA,gBAAC,KAAA;AAAA,gBAAA;AAAA,kBACC,SAAA,EAAU,oBAAA;AAAA,kBACV,EAAA,EAAI,SAAA;AAAA,kBACJ,iBAAA,EAAiB,SAAA;AAAA,kBACjB,QAAQ,CAAC,MAAA;AAAA,kBAER,QAAA,EAAA,IAAA,CAAK;AAAA;AAAA;AACR;AAAA,WAAA;AAAA,UA7CK,IAAA,CAAK;AAAA,SA8CZ;AAAA,MAEJ,CAAC,CAAA,EACH;AAAA;AAAA,GACF;AAEJ,CAAA;AAEA,IAAO,iBAAA,GAAQ","file":"flip-list.cjs","sourcesContent":["import React from 'react';\n\nimport './flip-list.css';\nimport { classnames } from '../helpers/classnames';\nimport Tag from '../tag';\n\nexport interface FlipListItem {\n id: React.Key;\n title: React.ReactNode;\n status?: React.ReactNode;\n meta?: React.ReactNode;\n content: React.ReactNode;\n}\n\nexport interface FlipListProps\n extends Omit<\n React.HTMLAttributes<HTMLDivElement>,\n 'children'\n > {\n items: FlipListItem[];\n\n /**\n * Currently opened item in controlled mode.\n *\n * `null` means that all items are closed.\n *\n * When this prop is provided, FlipList does not\n * own the opened-item state.\n */\n openId?: React.Key | null;\n\n /**\n * Item opened during the initial render\n * in uncontrolled mode.\n *\n * Later changes to this prop do not control\n * the component state.\n */\n defaultOpenId?: React.Key;\n\n /**\n * Called when the user requests a change\n * of the opened item.\n *\n * Receives the item id when an item is opened,\n * and `null` when the currently opened item\n * is closed.\n */\n onOpenChange?: (\n id: React.Key | null,\n ) => void;\n\n /**\n * Scrolls the item that is open during\n * the initial render into view once.\n *\n * In uncontrolled mode, the initial item comes\n * from `defaultOpenId`.\n *\n * In controlled mode, the initial item comes\n * from `openId`.\n *\n * Later state changes never trigger scrolling.\n */\n scrollToInitialOpen?: boolean;\n}\n\ntype OpenItemId = React.Key | null;\n\nfunction hasContent(\n value: React.ReactNode,\n): value is Exclude<\n React.ReactNode,\n null | undefined\n> {\n return value !== null && value !== undefined;\n}\n\nfunction normalizeOpenItemId(\n items: FlipListItem[],\n openId: OpenItemId | undefined,\n): OpenItemId {\n if (\n openId === null ||\n openId === undefined\n ) {\n return null;\n }\n\n const hasMatchingItem = items.some(\n (item) => item.id === openId,\n );\n\n return hasMatchingItem\n ? openId\n : null;\n}\n\nconst FlipList: React.FC<FlipListProps> = ({\n items,\n openId,\n defaultOpenId,\n onOpenChange,\n scrollToInitialOpen = false,\n className = '',\n ...props\n}) => {\n const componentId = React.useId();\n\n const isControlled =\n openId !== undefined;\n\n const initialOpenItemIdRef =\n React.useRef<OpenItemId>(\n normalizeOpenItemId(\n items,\n isControlled\n ? openId\n : defaultOpenId,\n ),\n );\n\n const shouldScrollInitiallyRef =\n React.useRef(scrollToInitialOpen);\n\n const initialOpenItemRef =\n React.useRef<HTMLDivElement | null>(\n null,\n );\n\n const hasScrolledInitiallyRef =\n React.useRef(false);\n\n const [\n uncontrolledOpenItemId,\n setUncontrolledOpenItemId,\n ] = React.useState<OpenItemId>(() =>\n normalizeOpenItemId(\n items,\n defaultOpenId,\n ),\n );\n\n const resolvedOpenItemId =\n normalizeOpenItemId(\n items,\n isControlled\n ? openId\n : uncontrolledOpenItemId,\n );\n\n React.useEffect(() => {\n if (\n hasScrolledInitiallyRef.current ||\n !shouldScrollInitiallyRef.current ||\n initialOpenItemIdRef.current === null ||\n !initialOpenItemRef.current\n ) {\n return;\n }\n\n hasScrolledInitiallyRef.current = true;\n\n initialOpenItemRef.current.scrollIntoView({\n behavior: 'auto',\n block: 'start',\n });\n }, []);\n\n if (items.length === 0) {\n return null;\n }\n\n const classes = classnames(\n 'flip-list',\n className,\n {},\n );\n\n const toggleItem = (\n itemId: React.Key,\n ) => {\n const nextOpenItemId =\n resolvedOpenItemId === itemId\n ? null\n : itemId;\n\n if (!isControlled) {\n setUncontrolledOpenItemId(\n nextOpenItemId,\n );\n }\n\n onOpenChange?.(nextOpenItemId);\n };\n\n return (\n <div\n className={classes}\n {...props}\n >\n <div className=\"flip-list__items\">\n {items.map((item, itemIndex) => {\n const isOpen =\n resolvedOpenItemId === item.id;\n\n const hasStatus = hasContent(\n item.status,\n );\n\n const hasMeta = hasContent(\n item.meta,\n );\n\n const triggerId =\n `${componentId}-trigger-${itemIndex}`;\n\n const contentId =\n `${componentId}-content-${itemIndex}`;\n\n const itemClasses = classnames(\n 'flip-list__item',\n '',\n {\n 'flip-list__item--open':\n isOpen,\n },\n );\n\n return (\n <div\n key={item.id}\n ref={\n item.id ===\n initialOpenItemIdRef.current\n ? initialOpenItemRef\n : undefined\n }\n className={itemClasses}\n >\n {hasStatus && (\n <div className=\"flip-list__status\">\n <Tag>\n {item.status}\n </Tag>\n </div>\n )}\n\n <button\n className=\"flip-list__trigger\"\n id={triggerId}\n type=\"button\"\n aria-expanded={isOpen}\n aria-controls={contentId}\n onClick={() =>\n toggleItem(item.id)\n }\n >\n <span className=\"flip-list__title\">\n {item.title}\n </span>\n\n {hasMeta && (\n <span className=\"flip-list__meta\">\n {item.meta}\n </span>\n )}\n </button>\n\n <div\n className=\"flip-list__content\"\n id={contentId}\n aria-labelledby={triggerId}\n hidden={!isOpen}\n >\n {item.content}\n </div>\n </div>\n );\n })}\n </div>\n </div>\n );\n};\n\nexport default FlipList;\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/flip-list/flip-list.tsx"],"names":["React","classnames","jsx","Icon","jsxs","Tag"],"mappings":";;;;;;;;;;;;;;;AAwEA,SAAS,WACP,KAAA,EAIA;AACA,EAAA,OAAO,KAAA,KAAU,QAAQ,KAAA,KAAU,MAAA;AACrC;AAEA,SAAS,mBAAA,CACP,OACA,MAAA,EACY;AACZ,EAAA,IACE,MAAA,KAAW,IAAA,IACX,MAAA,KAAW,MAAA,EACX;AACA,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,MAAM,kBAAkB,KAAA,CAAM,IAAA;AAAA,IAC5B,CAAC,IAAA,KAAS,IAAA,CAAK,EAAA,KAAO;AAAA,GACxB;AAEA,EAAA,OAAO,kBACH,MAAA,GACA,IAAA;AACN;AAEA,MAAM,WAAoC,CAAC;AAAA,EACzC,KAAA;AAAA,EACA,MAAA;AAAA,EACA,aAAA;AAAA,EACA,YAAA;AAAA,EACA,mBAAA,GAAsB,KAAA;AAAA,EACtB,SAAA,GAAY,EAAA;AAAA,EACZ,GAAG;AACL,CAAA,KAAM;AACJ,EAAA,MAAM,WAAA,GAAcA,uBAAM,KAAA,EAAM;AAEhC,EAAA,MAAM,eACJ,MAAA,KAAW,MAAA;AAEb,EAAA,MAAM,uBACJA,sBAAA,CAAM,MAAA;AAAA,IACJ,mBAAA;AAAA,MACE,KAAA;AAAA,MACA,eACI,MAAA,GACA;AAAA;AACN,GACF;AAEF,EAAA,MAAM,wBAAA,GACJA,sBAAA,CAAM,MAAA,CAAO,mBAAmB,CAAA;AAElC,EAAA,MAAM,qBACJA,sBAAA,CAAM,MAAA;AAAA,IACJ;AAAA,GACF;AAEF,EAAA,MAAM,uBAAA,GACJA,sBAAA,CAAM,MAAA,CAAO,KAAK,CAAA;AAEpB,EAAA,MAAM;AAAA,IACJ,sBAAA;AAAA,IACA;AAAA,MACEA,sBAAA,CAAM,QAAA;AAAA,IAAqB,MAC7B,mBAAA;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AA,EAAU,oBAAA;AAAA,oBACV,EAAA,EAAI,SAAA;AAAA,oBACJ,IAAA,EAAK,QAAA;AAAA,oBACL,eAAA,EAAe,MAAA;AAAA,oBACf,eAAA,EAAe,SAAA;AAAA,oBACf,OAAA,EAAS,MACP,UAAA,CAAW,IAAA,CAAK,EAAE,CAAA;AAAA,oBAGpB,QAAA,kBAAAA,cAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,kBAAA,EACb,eAAK,KAAA,EACR;AAAA;AAAA,iBACF;AAAA,gBAEC,kBAAA;AAAA,gBAEA,2BACCA,cAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,iBAAA,EACb,eAAK,IAAA,EACR;AAAA,eAAA,EAEJ,CAAA;AAAA,8BAEAA,cAAA;AAAA,gBAAC,KAAA;AAAA,gBAAA;AAAA,kBACC,SAAA,EAAU,oBAAA;AAAA,kBACV,EAAA,EAAI,SAAA;AAAA,kBACJ,iBAAA,EAAiB,SAAA;AAAA,kBACjB,QAAQ,CAAC,MAAA;AAAA,kBAER,QAAA,EAAA,IAAA,CAAK;AAAA;AAAA;AACR;AAAA,WAAA;AAAA,UAjDK,IAAA,CAAK;AAAA,SAkDZ;AAAA,MAEJ,CAAC,CAAA,EACH;AAAA;AAAA,GACF;AAEJ,CAAA;AAEA,IAAO,iBAAA,GAAQ","file":"flip-list.cjs","sourcesContent":["import React from 'react';\n\nimport './flip-list.css';\nimport Icon from '../../icons/icon';\nimport type { IconName } from '../../icons/types';\nimport { classnames } from '../helpers/classnames';\nimport Tag from '../tag';\n\nexport interface FlipListItem {\n id: React.Key;\n title: React.ReactNode;\n status?: React.ReactNode;\n statusIcon?: IconName;\n meta?: React.ReactNode;\n content: React.ReactNode;\n}\n\nexport interface FlipListProps\n extends Omit<\n React.HTMLAttributes<HTMLDivElement>,\n 'children'\n > {\n items: FlipListItem[];\n\n /**\n * Currently opened item in controlled mode.\n *\n * `null` means that all items are closed.\n *\n * When this prop is provided, FlipList does not\n * own the opened-item state.\n */\n openId?: React.Key | null;\n\n /**\n * Item opened during the initial render\n * in uncontrolled mode.\n *\n * Later changes to this prop do not control\n * the component state.\n */\n defaultOpenId?: React.Key;\n\n /**\n * Called when the user requests a change\n * of the opened item.\n *\n * Receives the item id when an item is opened,\n * and `null` when the currently opened item\n * is closed.\n */\n onOpenChange?: (\n id: React.Key | null,\n ) => void;\n\n /**\n * Scrolls the item that is open during\n * the initial render into view once.\n *\n * In uncontrolled mode, the initial item comes\n * from `defaultOpenId`.\n *\n * In controlled mode, the initial item comes\n * from `openId`.\n *\n * Later state changes never trigger scrolling.\n */\n scrollToInitialOpen?: boolean;\n}\n\ntype OpenItemId = React.Key | null;\n\nfunction hasContent(\n value: React.ReactNode,\n): value is Exclude<\n React.ReactNode,\n null | undefined\n> {\n return value !== null && value !== undefined;\n}\n\nfunction normalizeOpenItemId(\n items: FlipListItem[],\n openId: OpenItemId | undefined,\n): OpenItemId {\n if (\n openId === null ||\n openId === undefined\n ) {\n return null;\n }\n\n const hasMatchingItem = items.some(\n (item) => item.id === openId,\n );\n\n return hasMatchingItem\n ? openId\n : null;\n}\n\nconst FlipList: React.FC<FlipListProps> = ({\n items,\n openId,\n defaultOpenId,\n onOpenChange,\n scrollToInitialOpen = false,\n className = '',\n ...props\n}) => {\n const componentId = React.useId();\n\n const isControlled =\n openId !== undefined;\n\n const initialOpenItemIdRef =\n React.useRef<OpenItemId>(\n normalizeOpenItemId(\n items,\n isControlled\n ? openId\n : defaultOpenId,\n ),\n );\n\n const shouldScrollInitiallyRef =\n React.useRef(scrollToInitialOpen);\n\n const initialOpenItemRef =\n React.useRef<HTMLDivElement | null>(\n null,\n );\n\n const hasScrolledInitiallyRef =\n React.useRef(false);\n\n const [\n uncontrolledOpenItemId,\n setUncontrolledOpenItemId,\n ] = React.useState<OpenItemId>(() =>\n normalizeOpenItemId(\n items,\n defaultOpenId,\n ),\n );\n\n const resolvedOpenItemId =\n normalizeOpenItemId(\n items,\n isControlled\n ? openId\n : uncontrolledOpenItemId,\n );\n\n React.useEffect(() => {\n if (\n hasScrolledInitiallyRef.current ||\n !shouldScrollInitiallyRef.current ||\n initialOpenItemIdRef.current === null ||\n !initialOpenItemRef.current\n ) {\n return;\n }\n\n hasScrolledInitiallyRef.current = true;\n\n initialOpenItemRef.current.scrollIntoView({\n behavior: 'auto',\n block: 'start',\n });\n }, []);\n\n if (items.length === 0) {\n return null;\n }\n\n const classes = classnames(\n 'flip-list',\n className,\n {},\n );\n\n const toggleItem = (\n itemId: React.Key,\n ) => {\n const nextOpenItemId =\n resolvedOpenItemId === itemId\n ? null\n : itemId;\n\n if (!isControlled) {\n setUncontrolledOpenItemId(\n nextOpenItemId,\n );\n }\n\n onOpenChange?.(nextOpenItemId);\n };\n\n return (\n <div\n className={classes}\n {...props}\n >\n <div className=\"flip-list__items\">\n {items.map((item, itemIndex) => {\n const isOpen =\n resolvedOpenItemId === item.id;\n\n const hasStatus = hasContent(\n item.status,\n );\n\n const statusIcon =\n item.statusIcon;\n\n const hasMeta = hasContent(\n item.meta,\n );\n\n const triggerId =\n `${componentId}-trigger-${itemIndex}`;\n\n const contentId =\n `${componentId}-content-${itemIndex}`;\n\n const itemClasses = classnames(\n 'flip-list__item',\n '',\n {\n 'flip-list__item--open':\n isOpen,\n },\n );\n\n const resolvedStatusIcon =\n statusIcon !== undefined ? (\n <Icon\n name={statusIcon}\n size=\"base\"\n className=\"flip-list__status-icon\"\n aria-hidden\n focusable={false}\n />\n ) : null;\n\n return (\n <div\n key={item.id}\n ref={\n item.id ===\n initialOpenItemIdRef.current\n ? initialOpenItemRef\n : undefined\n }\n className={itemClasses}\n >\n {hasStatus && (\n <div className=\"flip-list__status\">\n <Tag>\n {item.status}\n </Tag>\n </div>\n )}\n\n <div className=\"flip-list__heading\">\n <button\n className=\"flip-list__trigger\"\n id={triggerId}\n type=\"button\"\n aria-expanded={isOpen}\n aria-controls={contentId}\n onClick={() =>\n toggleItem(item.id)\n }\n >\n <span className=\"flip-list__title\">\n {item.title}\n </span>\n </button>\n\n {resolvedStatusIcon}\n\n {hasMeta && (\n <span className=\"flip-list__meta\">\n {item.meta}\n </span>\n )}\n </div>\n\n <div\n className=\"flip-list__content\"\n id={contentId}\n aria-labelledby={triggerId}\n hidden={!isOpen}\n >\n {item.content}\n </div>\n </div>\n );\n })}\n </div>\n </div>\n );\n};\n\nexport default FlipList;\n"]}
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
--flip-list-open-content-gap:
|
|
49
49
|
var(--font-h2-margin);
|
|
50
50
|
--flip-list-trigger-column-gap:
|
|
51
|
-
var(--margin-
|
|
51
|
+
var(--margin-icon);
|
|
52
52
|
--flip-list-scroll-margin-block-start:
|
|
53
53
|
0px;
|
|
54
54
|
|
|
@@ -121,74 +121,92 @@
|
|
|
121
121
|
/* motion */
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
.flip-
|
|
124
|
+
.flip-list__status {
|
|
125
|
+
/* color */
|
|
126
|
+
|
|
127
|
+
/* typography */
|
|
128
|
+
|
|
129
|
+
/* size */
|
|
130
|
+
--flip-list-status-gap:
|
|
131
|
+
var(--margin-tag);
|
|
132
|
+
|
|
133
|
+
display: block;
|
|
134
|
+
align-self: flex-start;
|
|
135
|
+
min-width: 0;
|
|
136
|
+
max-width: 100%;
|
|
137
|
+
margin:
|
|
138
|
+
0
|
|
139
|
+
0
|
|
140
|
+
var(--flip-list-status-gap)
|
|
141
|
+
0;
|
|
142
|
+
|
|
143
|
+
/* border */
|
|
144
|
+
|
|
145
|
+
/* depth */
|
|
146
|
+
|
|
147
|
+
/* motion */
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.flip-list__heading {
|
|
125
151
|
/* color */
|
|
126
|
-
background: transparent;
|
|
127
|
-
color: var(--flip-list-trigger-color);
|
|
128
152
|
|
|
129
153
|
/* typography */
|
|
130
|
-
font: inherit;
|
|
131
|
-
text-align: left;
|
|
132
154
|
|
|
133
155
|
/* size */
|
|
134
156
|
display: flex;
|
|
135
157
|
align-items: center;
|
|
136
|
-
justify-content: space-between;
|
|
137
158
|
gap: var(--flip-list-trigger-column-gap);
|
|
138
159
|
width: 100%;
|
|
139
160
|
min-width: 0;
|
|
140
161
|
max-width: 100%;
|
|
141
|
-
padding: 0;
|
|
142
162
|
|
|
143
163
|
/* border */
|
|
144
|
-
border: 0;
|
|
145
164
|
|
|
146
165
|
/* depth */
|
|
147
166
|
|
|
148
167
|
/* motion */
|
|
149
|
-
cursor: pointer;
|
|
150
168
|
}
|
|
151
169
|
|
|
152
|
-
.flip-list__trigger
|
|
170
|
+
.flip-list__trigger {
|
|
153
171
|
/* color */
|
|
172
|
+
background: transparent;
|
|
173
|
+
color: var(--flip-list-trigger-color);
|
|
154
174
|
|
|
155
175
|
/* typography */
|
|
176
|
+
font: inherit;
|
|
177
|
+
text-align: left;
|
|
156
178
|
|
|
157
179
|
/* size */
|
|
180
|
+
display: flex;
|
|
181
|
+
flex: 0 1 auto;
|
|
182
|
+
align-items: center;
|
|
183
|
+
min-width: 0;
|
|
184
|
+
max-width: 100%;
|
|
185
|
+
padding: 0;
|
|
158
186
|
|
|
159
187
|
/* border */
|
|
160
|
-
|
|
161
|
-
var(--size-border-width-focus)
|
|
162
|
-
solid
|
|
163
|
-
currentColor;
|
|
164
|
-
outline-offset:
|
|
165
|
-
var(--size-border-offset-focus);
|
|
188
|
+
border: 0;
|
|
166
189
|
|
|
167
190
|
/* depth */
|
|
168
191
|
|
|
169
192
|
/* motion */
|
|
193
|
+
cursor: pointer;
|
|
170
194
|
}
|
|
171
195
|
|
|
172
|
-
.flip-
|
|
196
|
+
.flip-list__trigger:focus-visible {
|
|
173
197
|
/* color */
|
|
174
198
|
|
|
175
199
|
/* typography */
|
|
176
200
|
|
|
177
201
|
/* size */
|
|
178
|
-
--flip-list-status-gap:
|
|
179
|
-
var(--margin-tag);
|
|
180
|
-
|
|
181
|
-
display: block;
|
|
182
|
-
align-self: flex-start;
|
|
183
|
-
min-width: 0;
|
|
184
|
-
max-width: 100%;
|
|
185
|
-
margin:
|
|
186
|
-
0
|
|
187
|
-
0
|
|
188
|
-
var(--flip-list-status-gap)
|
|
189
|
-
0;
|
|
190
202
|
|
|
191
203
|
/* border */
|
|
204
|
+
outline:
|
|
205
|
+
var(--size-border-width-focus)
|
|
206
|
+
solid
|
|
207
|
+
currentColor;
|
|
208
|
+
outline-offset:
|
|
209
|
+
var(--size-border-offset-focus);
|
|
192
210
|
|
|
193
211
|
/* depth */
|
|
194
212
|
|
|
@@ -217,7 +235,6 @@
|
|
|
217
235
|
text-underline-offset: from-font;
|
|
218
236
|
|
|
219
237
|
/* size */
|
|
220
|
-
flex: 1 1 auto;
|
|
221
238
|
min-width: 0;
|
|
222
239
|
max-width: 100%;
|
|
223
240
|
overflow-wrap: anywhere;
|
|
@@ -245,6 +262,21 @@
|
|
|
245
262
|
/* motion */
|
|
246
263
|
}
|
|
247
264
|
|
|
265
|
+
.flip-list__status-icon {
|
|
266
|
+
/* color */
|
|
267
|
+
|
|
268
|
+
/* typography */
|
|
269
|
+
|
|
270
|
+
/* size */
|
|
271
|
+
flex: 0 0 auto;
|
|
272
|
+
|
|
273
|
+
/* border */
|
|
274
|
+
|
|
275
|
+
/* depth */
|
|
276
|
+
|
|
277
|
+
/* motion */
|
|
278
|
+
}
|
|
279
|
+
|
|
248
280
|
.flip-list__meta {
|
|
249
281
|
/* color */
|
|
250
282
|
color: var(--flip-list-meta-color);
|
|
@@ -266,6 +298,7 @@
|
|
|
266
298
|
flex: 0 0 auto;
|
|
267
299
|
min-width: 0;
|
|
268
300
|
max-width: 100%;
|
|
301
|
+
margin-left: auto;
|
|
269
302
|
|
|
270
303
|
/* border */
|
|
271
304
|
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import './flip-list.css';
|
|
3
|
+
import type { IconName } from '../../icons/types';
|
|
3
4
|
export interface FlipListItem {
|
|
4
5
|
id: React.Key;
|
|
5
6
|
title: React.ReactNode;
|
|
6
7
|
status?: React.ReactNode;
|
|
8
|
+
statusIcon?: IconName;
|
|
7
9
|
meta?: React.ReactNode;
|
|
8
10
|
content: React.ReactNode;
|
|
9
11
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import './flip-list.css';
|
|
4
|
+
import Icon from '../../icons/icon';
|
|
4
5
|
import { classnames } from '../helpers/classnames';
|
|
5
6
|
import Tag from '../tag';
|
|
6
7
|
|
|
@@ -88,6 +89,7 @@ const FlipList = ({
|
|
|
88
89
|
const hasStatus = hasContent(
|
|
89
90
|
item.status
|
|
90
91
|
);
|
|
92
|
+
const statusIcon = item.statusIcon;
|
|
91
93
|
const hasMeta = hasContent(
|
|
92
94
|
item.meta
|
|
93
95
|
);
|
|
@@ -100,6 +102,16 @@ const FlipList = ({
|
|
|
100
102
|
"flip-list__item--open": isOpen
|
|
101
103
|
}
|
|
102
104
|
);
|
|
105
|
+
const resolvedStatusIcon = statusIcon !== void 0 ? /* @__PURE__ */ jsx(
|
|
106
|
+
Icon,
|
|
107
|
+
{
|
|
108
|
+
name: statusIcon,
|
|
109
|
+
size: "base",
|
|
110
|
+
className: "flip-list__status-icon",
|
|
111
|
+
"aria-hidden": true,
|
|
112
|
+
focusable: false
|
|
113
|
+
}
|
|
114
|
+
) : null;
|
|
103
115
|
return /* @__PURE__ */ jsxs(
|
|
104
116
|
"div",
|
|
105
117
|
{
|
|
@@ -107,21 +119,22 @@ const FlipList = ({
|
|
|
107
119
|
className: itemClasses,
|
|
108
120
|
children: [
|
|
109
121
|
hasStatus && /* @__PURE__ */ jsx("div", { className: "flip-list__status", children: /* @__PURE__ */ jsx(Tag, { children: item.status }) }),
|
|
110
|
-
/* @__PURE__ */ jsxs(
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
/* @__PURE__ */ jsx("span", { className: "flip-list__title", children: item.title })
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
122
|
+
/* @__PURE__ */ jsxs("div", { className: "flip-list__heading", children: [
|
|
123
|
+
/* @__PURE__ */ jsx(
|
|
124
|
+
"button",
|
|
125
|
+
{
|
|
126
|
+
className: "flip-list__trigger",
|
|
127
|
+
id: triggerId,
|
|
128
|
+
type: "button",
|
|
129
|
+
"aria-expanded": isOpen,
|
|
130
|
+
"aria-controls": contentId,
|
|
131
|
+
onClick: () => toggleItem(item.id),
|
|
132
|
+
children: /* @__PURE__ */ jsx("span", { className: "flip-list__title", children: item.title })
|
|
133
|
+
}
|
|
134
|
+
),
|
|
135
|
+
resolvedStatusIcon,
|
|
136
|
+
hasMeta && /* @__PURE__ */ jsx("span", { className: "flip-list__meta", children: item.meta })
|
|
137
|
+
] }),
|
|
125
138
|
/* @__PURE__ */ jsx(
|
|
126
139
|
"div",
|
|
127
140
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/flip-list/flip-list.tsx"],"names":[],"mappings":";;;;;;AAqEA,SAAS,WACP,KAAA,EAIA;AACA,EAAA,OAAO,KAAA,KAAU,QAAQ,KAAA,KAAU,MAAA;AACrC;AAEA,SAAS,mBAAA,CACP,OACA,MAAA,EACY;AACZ,EAAA,IACE,MAAA,KAAW,IAAA,IACX,MAAA,KAAW,MAAA,EACX;AACA,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,MAAM,kBAAkB,KAAA,CAAM,IAAA;AAAA,IAC5B,CAAC,IAAA,KAAS,IAAA,CAAK,EAAA,KAAO;AAAA,GACxB;AAEA,EAAA,OAAO,kBACH,MAAA,GACA,IAAA;AACN;AAEA,MAAM,WAAoC,CAAC;AAAA,EACzC,KAAA;AAAA,EACA,MAAA;AAAA,EACA,aAAA;AAAA,EACA,YAAA;AAAA,EACA,mBAAA,GAAsB,KAAA;AAAA,EACt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,oBACC,GAAA,CAAC,SAAI,SAAA,EAAU,mBAAA,EACb,8BAAC,GAAA,EAAA,EACE,QAAA,EAAA,IAAA,CAAK,QACR,CAAA,EACF,CAAA;AAAA,8BAGF,IAAA;AAAA,gBAAC,QAAA;AAAA,gBAAA;AAAA,kBACC,SAAA,EAAU,oBAAA;AAAA,kBACV,EAAA,EAAI,SAAA;AAAA,kBACJ,IAAA,EAAK,QAAA;AAAA,kBACL,eAAA,EAAe,MAAA;AAAA,kBACf,eAAA,EAAe,SAAA;AAAA,kBACf,OAAA,EAAS,MACP,UAAA,CAAW,IAAA,CAAK,EAAE,CAAA;AAAA,kBAGpB,QAAA,EAAA;AAAA,oCAAA,GAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,kBAAA,EACb,QAAA,EAAA,IAAA,CAAK,KAAA,EACR,CAAA;AAAA,oBAEC,2BACC,GAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,iBAAA,EACb,eAAK,IAAA,EACR;AAAA;AAAA;AAAA,eAEJ;AAAA,8BAEA,GAAA;AAAA,gBAAC,KAAA;AAAA,gBAAA;AAAA,kBACC,SAAA,EAAU,oBAAA;AAAA,kBACV,EAAA,EAAI,SAAA;AAAA,kBACJ,iBAAA,EAAiB,SAAA;AAAA,kBACjB,QAAQ,CAAC,MAAA;AAAA,kBAER,QAAA,EAAA,IAAA,CAAK;AAAA;AAAA;AACR;AAAA,WAAA;AAAA,UA7CK,IAAA,CAAK;AAAA,SA8CZ;AAAA,MAEJ,CAAC,CAAA,EACH;AAAA;AAAA,GACF;AAEJ,CAAA;AAEA,IAAO,iBAAA,GAAQ","file":"flip-list.js","sourcesContent":["import React from 'react';\n\nimport './flip-list.css';\nimport { classnames } from '../helpers/classnames';\nimport Tag from '../tag';\n\nexport interface FlipListItem {\n id: React.Key;\n title: React.ReactNode;\n status?: React.ReactNode;\n meta?: React.ReactNode;\n content: React.ReactNode;\n}\n\nexport interface FlipListProps\n extends Omit<\n React.HTMLAttributes<HTMLDivElement>,\n 'children'\n > {\n items: FlipListItem[];\n\n /**\n * Currently opened item in controlled mode.\n *\n * `null` means that all items are closed.\n *\n * When this prop is provided, FlipList does not\n * own the opened-item state.\n */\n openId?: React.Key | null;\n\n /**\n * Item opened during the initial render\n * in uncontrolled mode.\n *\n * Later changes to this prop do not control\n * the component state.\n */\n defaultOpenId?: React.Key;\n\n /**\n * Called when the user requests a change\n * of the opened item.\n *\n * Receives the item id when an item is opened,\n * and `null` when the currently opened item\n * is closed.\n */\n onOpenChange?: (\n id: React.Key | null,\n ) => void;\n\n /**\n * Scrolls the item that is open during\n * the initial render into view once.\n *\n * In uncontrolled mode, the initial item comes\n * from `defaultOpenId`.\n *\n * In controlled mode, the initial item comes\n * from `openId`.\n *\n * Later state changes never trigger scrolling.\n */\n scrollToInitialOpen?: boolean;\n}\n\ntype OpenItemId = React.Key | null;\n\nfunction hasContent(\n value: React.ReactNode,\n): value is Exclude<\n React.ReactNode,\n null | undefined\n> {\n return value !== null && value !== undefined;\n}\n\nfunction normalizeOpenItemId(\n items: FlipListItem[],\n openId: OpenItemId | undefined,\n): OpenItemId {\n if (\n openId === null ||\n openId === undefined\n ) {\n return null;\n }\n\n const hasMatchingItem = items.some(\n (item) => item.id === openId,\n );\n\n return hasMatchingItem\n ? openId\n : null;\n}\n\nconst FlipList: React.FC<FlipListProps> = ({\n items,\n openId,\n defaultOpenId,\n onOpenChange,\n scrollToInitialOpen = false,\n className = '',\n ...props\n}) => {\n const componentId = React.useId();\n\n const isControlled =\n openId !== undefined;\n\n const initialOpenItemIdRef =\n React.useRef<OpenItemId>(\n normalizeOpenItemId(\n items,\n isControlled\n ? openId\n : defaultOpenId,\n ),\n );\n\n const shouldScrollInitiallyRef =\n React.useRef(scrollToInitialOpen);\n\n const initialOpenItemRef =\n React.useRef<HTMLDivElement | null>(\n null,\n );\n\n const hasScrolledInitiallyRef =\n React.useRef(false);\n\n const [\n uncontrolledOpenItemId,\n setUncontrolledOpenItemId,\n ] = React.useState<OpenItemId>(() =>\n normalizeOpenItemId(\n items,\n defaultOpenId,\n ),\n );\n\n const resolvedOpenItemId =\n normalizeOpenItemId(\n items,\n isControlled\n ? openId\n : uncontrolledOpenItemId,\n );\n\n React.useEffect(() => {\n if (\n hasScrolledInitiallyRef.current ||\n !shouldScrollInitiallyRef.current ||\n initialOpenItemIdRef.current === null ||\n !initialOpenItemRef.current\n ) {\n return;\n }\n\n hasScrolledInitiallyRef.current = true;\n\n initialOpenItemRef.current.scrollIntoView({\n behavior: 'auto',\n block: 'start',\n });\n }, []);\n\n if (items.length === 0) {\n return null;\n }\n\n const classes = classnames(\n 'flip-list',\n className,\n {},\n );\n\n const toggleItem = (\n itemId: React.Key,\n ) => {\n const nextOpenItemId =\n resolvedOpenItemId === itemId\n ? null\n : itemId;\n\n if (!isControlled) {\n setUncontrolledOpenItemId(\n nextOpenItemId,\n );\n }\n\n onOpenChange?.(nextOpenItemId);\n };\n\n return (\n <div\n className={classes}\n {...props}\n >\n <div className=\"flip-list__items\">\n {items.map((item, itemIndex) => {\n const isOpen =\n resolvedOpenItemId === item.id;\n\n const hasStatus = hasContent(\n item.status,\n );\n\n const hasMeta = hasContent(\n item.meta,\n );\n\n const triggerId =\n `${componentId}-trigger-${itemIndex}`;\n\n const contentId =\n `${componentId}-content-${itemIndex}`;\n\n const itemClasses = classnames(\n 'flip-list__item',\n '',\n {\n 'flip-list__item--open':\n isOpen,\n },\n );\n\n return (\n <div\n key={item.id}\n ref={\n item.id ===\n initialOpenItemIdRef.current\n ? initialOpenItemRef\n : undefined\n }\n className={itemClasses}\n >\n {hasStatus && (\n <div className=\"flip-list__status\">\n <Tag>\n {item.status}\n </Tag>\n </div>\n )}\n\n <button\n className=\"flip-list__trigger\"\n id={triggerId}\n type=\"button\"\n aria-expanded={isOpen}\n aria-controls={contentId}\n onClick={() =>\n toggleItem(item.id)\n }\n >\n <span className=\"flip-list__title\">\n {item.title}\n </span>\n\n {hasMeta && (\n <span className=\"flip-list__meta\">\n {item.meta}\n </span>\n )}\n </button>\n\n <div\n className=\"flip-list__content\"\n id={contentId}\n aria-labelledby={triggerId}\n hidden={!isOpen}\n >\n {item.content}\n </div>\n </div>\n );\n })}\n </div>\n </div>\n );\n};\n\nexport default FlipList;\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/flip-list/flip-list.tsx"],"names":[],"mappings":";;;;;;;AAwEA,SAAS,WACP,KAAA,EAIA;AACA,EAAA,OAAO,KAAA,KAAU,QAAQ,KAAA,KAAU,MAAA;AACrC;AAEA,SAAS,mBAAA,CACP,OACA,MAAA,EACY;AACZ,EAAA,IACE,MAAA,KAAW,IAAA,IACX,MAAA,KAAW,MAAA,EACX;AACA,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,MAAM,kBAAkB,KAAA,CAAM,IAAA;AAAA,IAC5B,CAAC,IAAA,KAAS,IAAA,CAAK,EAAA,KAAO;AAAA,GACxB;AAEA,EAAA,OAAO,kBACH,MAAA,GACA,IAAA;AACN;AAEA,MAAM,WAAoC,CAAC;AAAA,EACzC,KAAA;AAAA,EACA,MAAA;AAAA,EACA,aAAA;AAAA,EACA,YAAA;AAAA,EACA,mBAAA,GAAsB,KAAA;AAAA,EACtB,SAAA,GAAY,EAAA;AAAA,EACZ,GAAG;AACL,CAAA,KAAM;AACJ,EAAA,MAAM,WAAA,GAAc,MAAM,KAAA,EAAM;AAEhC,EAAA,MAAM,eACJ,MAAA,KAAW,MAAA;AAEb,EAAA,MAAM,uBACJ,KAAA,CAAM,MAAA;AAAA,IACJ,mBAAA;AAAA,MACE,KAAA;AAAA,MACA,eACI,MAAA,GACA;AAAA;AACN,GACF;AAEF,EAAA,MAAM,wBAAA,GACJ,KAAA,CAAM,MAAA,CAAO,mBAAmB,CAAA;AAElC,EAAA,MAAM,qBACJ,KAAA,CAAM,MAAA;AAAA,IACJ;AAAA,GACF;AAEF,EAAA,MAAM,uBAAA,GACJ,KAAA,CAAM,MAAA,CAAO,KAAK,CAAA;AAEp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EACb,QAAA,EAAA;AAAA,gCAAA,GAAA;AAAA,kBAAC,QAAA;AAAA,kBAAA;AAAA,oBACC,SAAA,EAAU,oBAAA;AAAA,oBACV,EAAA,EAAI,SAAA;AAAA,oBACJ,IAAA,EAAK,QAAA;AAAA,oBACL,eAAA,EAAe,MAAA;AAAA,oBACf,eAAA,EAAe,SAAA;AAAA,oBACf,OAAA,EAAS,MACP,UAAA,CAAW,IAAA,CAAK,EAAE,CAAA;AAAA,oBAGpB,QAAA,kBAAA,GAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,kBAAA,EACb,eAAK,KAAA,EACR;AAAA;AAAA,iBACF;AAAA,gBAEC,kBAAA;AAAA,gBAEA,2BACC,GAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,iBAAA,EACb,eAAK,IAAA,EACR;AAAA,eAAA,EAEJ,CAAA;AAAA,8BAEA,GAAA;AAAA,gBAAC,KAAA;AAAA,gBAAA;AAAA,kBACC,SAAA,EAAU,oBAAA;AAAA,kBACV,EAAA,EAAI,SAAA;AAAA,kBACJ,iBAAA,EAAiB,SAAA;AAAA,kBACjB,QAAQ,CAAC,MAAA;AAAA,kBAER,QAAA,EAAA,IAAA,CAAK;AAAA;AAAA;AACR;AAAA,WAAA;AAAA,UAjDK,IAAA,CAAK;AAAA,SAkDZ;AAAA,MAEJ,CAAC,CAAA,EACH;AAAA;AAAA,GACF;AAEJ,CAAA;AAEA,IAAO,iBAAA,GAAQ","file":"flip-list.js","sourcesContent":["import React from 'react';\n\nimport './flip-list.css';\nimport Icon from '../../icons/icon';\nimport type { IconName } from '../../icons/types';\nimport { classnames } from '../helpers/classnames';\nimport Tag from '../tag';\n\nexport interface FlipListItem {\n id: React.Key;\n title: React.ReactNode;\n status?: React.ReactNode;\n statusIcon?: IconName;\n meta?: React.ReactNode;\n content: React.ReactNode;\n}\n\nexport interface FlipListProps\n extends Omit<\n React.HTMLAttributes<HTMLDivElement>,\n 'children'\n > {\n items: FlipListItem[];\n\n /**\n * Currently opened item in controlled mode.\n *\n * `null` means that all items are closed.\n *\n * When this prop is provided, FlipList does not\n * own the opened-item state.\n */\n openId?: React.Key | null;\n\n /**\n * Item opened during the initial render\n * in uncontrolled mode.\n *\n * Later changes to this prop do not control\n * the component state.\n */\n defaultOpenId?: React.Key;\n\n /**\n * Called when the user requests a change\n * of the opened item.\n *\n * Receives the item id when an item is opened,\n * and `null` when the currently opened item\n * is closed.\n */\n onOpenChange?: (\n id: React.Key | null,\n ) => void;\n\n /**\n * Scrolls the item that is open during\n * the initial render into view once.\n *\n * In uncontrolled mode, the initial item comes\n * from `defaultOpenId`.\n *\n * In controlled mode, the initial item comes\n * from `openId`.\n *\n * Later state changes never trigger scrolling.\n */\n scrollToInitialOpen?: boolean;\n}\n\ntype OpenItemId = React.Key | null;\n\nfunction hasContent(\n value: React.ReactNode,\n): value is Exclude<\n React.ReactNode,\n null | undefined\n> {\n return value !== null && value !== undefined;\n}\n\nfunction normalizeOpenItemId(\n items: FlipListItem[],\n openId: OpenItemId | undefined,\n): OpenItemId {\n if (\n openId === null ||\n openId === undefined\n ) {\n return null;\n }\n\n const hasMatchingItem = items.some(\n (item) => item.id === openId,\n );\n\n return hasMatchingItem\n ? openId\n : null;\n}\n\nconst FlipList: React.FC<FlipListProps> = ({\n items,\n openId,\n defaultOpenId,\n onOpenChange,\n scrollToInitialOpen = false,\n className = '',\n ...props\n}) => {\n const componentId = React.useId();\n\n const isControlled =\n openId !== undefined;\n\n const initialOpenItemIdRef =\n React.useRef<OpenItemId>(\n normalizeOpenItemId(\n items,\n isControlled\n ? openId\n : defaultOpenId,\n ),\n );\n\n const shouldScrollInitiallyRef =\n React.useRef(scrollToInitialOpen);\n\n const initialOpenItemRef =\n React.useRef<HTMLDivElement | null>(\n null,\n );\n\n const hasScrolledInitiallyRef =\n React.useRef(false);\n\n const [\n uncontrolledOpenItemId,\n setUncontrolledOpenItemId,\n ] = React.useState<OpenItemId>(() =>\n normalizeOpenItemId(\n items,\n defaultOpenId,\n ),\n );\n\n const resolvedOpenItemId =\n normalizeOpenItemId(\n items,\n isControlled\n ? openId\n : uncontrolledOpenItemId,\n );\n\n React.useEffect(() => {\n if (\n hasScrolledInitiallyRef.current ||\n !shouldScrollInitiallyRef.current ||\n initialOpenItemIdRef.current === null ||\n !initialOpenItemRef.current\n ) {\n return;\n }\n\n hasScrolledInitiallyRef.current = true;\n\n initialOpenItemRef.current.scrollIntoView({\n behavior: 'auto',\n block: 'start',\n });\n }, []);\n\n if (items.length === 0) {\n return null;\n }\n\n const classes = classnames(\n 'flip-list',\n className,\n {},\n );\n\n const toggleItem = (\n itemId: React.Key,\n ) => {\n const nextOpenItemId =\n resolvedOpenItemId === itemId\n ? null\n : itemId;\n\n if (!isControlled) {\n setUncontrolledOpenItemId(\n nextOpenItemId,\n );\n }\n\n onOpenChange?.(nextOpenItemId);\n };\n\n return (\n <div\n className={classes}\n {...props}\n >\n <div className=\"flip-list__items\">\n {items.map((item, itemIndex) => {\n const isOpen =\n resolvedOpenItemId === item.id;\n\n const hasStatus = hasContent(\n item.status,\n );\n\n const statusIcon =\n item.statusIcon;\n\n const hasMeta = hasContent(\n item.meta,\n );\n\n const triggerId =\n `${componentId}-trigger-${itemIndex}`;\n\n const contentId =\n `${componentId}-content-${itemIndex}`;\n\n const itemClasses = classnames(\n 'flip-list__item',\n '',\n {\n 'flip-list__item--open':\n isOpen,\n },\n );\n\n const resolvedStatusIcon =\n statusIcon !== undefined ? (\n <Icon\n name={statusIcon}\n size=\"base\"\n className=\"flip-list__status-icon\"\n aria-hidden\n focusable={false}\n />\n ) : null;\n\n return (\n <div\n key={item.id}\n ref={\n item.id ===\n initialOpenItemIdRef.current\n ? initialOpenItemRef\n : undefined\n }\n className={itemClasses}\n >\n {hasStatus && (\n <div className=\"flip-list__status\">\n <Tag>\n {item.status}\n </Tag>\n </div>\n )}\n\n <div className=\"flip-list__heading\">\n <button\n className=\"flip-list__trigger\"\n id={triggerId}\n type=\"button\"\n aria-expanded={isOpen}\n aria-controls={contentId}\n onClick={() =>\n toggleItem(item.id)\n }\n >\n <span className=\"flip-list__title\">\n {item.title}\n </span>\n </button>\n\n {resolvedStatusIcon}\n\n {hasMeta && (\n <span className=\"flip-list__meta\">\n {item.meta}\n </span>\n )}\n </div>\n\n <div\n className=\"flip-list__content\"\n id={contentId}\n aria-labelledby={triggerId}\n hidden={!isOpen}\n >\n {item.content}\n </div>\n </div>\n );\n })}\n </div>\n </div>\n );\n};\n\nexport default FlipList;\n"]}
|
package/components/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var button = require('./button');
|
|
4
|
-
var input = require('./input
|
|
5
|
-
var textarea = require('./textarea
|
|
4
|
+
var input = require('./input');
|
|
5
|
+
var textarea = require('./textarea');
|
|
6
6
|
var select = require('./select/select');
|
|
7
7
|
var dropdown = require('./dropdown/dropdown');
|
|
8
8
|
var checkbox = require('./checkbox/checkbox');
|
package/components/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export { default as Button } from './button';
|
|
2
2
|
export { buttonLink, } from './button';
|
|
3
3
|
export type { ButtonProps, } from './button';
|
|
4
|
-
export { default as Input } from './input
|
|
5
|
-
export type { InputProps } from './input
|
|
6
|
-
export { default as Textarea } from './textarea
|
|
7
|
-
export type { TextareaProps } from './textarea
|
|
4
|
+
export { default as Input } from './input';
|
|
5
|
+
export type { InputProps } from './input';
|
|
6
|
+
export { default as Textarea } from './textarea';
|
|
7
|
+
export type { TextareaProps } from './textarea';
|
|
8
8
|
export { default as Select } from './select/select';
|
|
9
9
|
export type { SelectProps } from './select/select';
|
|
10
10
|
export { default as Dropdown } from './dropdown/dropdown';
|
package/components/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { default as Button, buttonLink } from './button';
|
|
2
|
-
export { default as Input } from './input
|
|
3
|
-
export { default as Textarea } from './textarea
|
|
2
|
+
export { default as Input } from './input';
|
|
3
|
+
export { default as Textarea } from './textarea';
|
|
4
4
|
export { default as Select } from './select/select';
|
|
5
5
|
export { default as Dropdown } from './dropdown/dropdown';
|
|
6
6
|
export { default as Checkbox } from './checkbox/checkbox';
|
|
@@ -5,14 +5,22 @@ var classnames = require('../helpers/classnames');
|
|
|
5
5
|
|
|
6
6
|
const Input = ({
|
|
7
7
|
state = "default",
|
|
8
|
+
width = "default",
|
|
8
9
|
className = "",
|
|
9
10
|
disabled = false,
|
|
10
11
|
...props
|
|
11
12
|
}) => {
|
|
12
|
-
const classes = classnames.classnames(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
const classes = classnames.classnames(
|
|
14
|
+
"input",
|
|
15
|
+
className,
|
|
16
|
+
{
|
|
17
|
+
"input--error": state === "error",
|
|
18
|
+
"input--success": state === "success",
|
|
19
|
+
"input--width-short": width === "short",
|
|
20
|
+
"input--width-default": width === "default",
|
|
21
|
+
"input--width-max": width === "max"
|
|
22
|
+
}
|
|
23
|
+
);
|
|
16
24
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
17
25
|
"input",
|
|
18
26
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/input/input.tsx"],"names":["classnames","jsx"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"sources":["../../../src/components/input/input.tsx"],"names":["classnames","jsx"],"mappings":";;;;;AAcA,MAAM,QAA8B,CAAC;AAAA,EACnC,KAAA,GAAQ,SAAA;AAAA,EACR,KAAA,GAAQ,SAAA;AAAA,EACR,SAAA,GAAY,EAAA;AAAA,EACZ,QAAA,GAAW,KAAA;AAAA,EACX,GAAG;AACL,CAAA,KAAM;AACJ,EAAA,MAAM,OAAA,GAAUA,qBAAA;AAAA,IACd,OAAA;AAAA,IACA,SAAA;AAAA,IACA;AAAA,MACE,gBACE,KAAA,KAAU,OAAA;AAAA,MACZ,kBACE,KAAA,KAAU,SAAA;AAAA,MACZ,sBACE,KAAA,KAAU,OAAA;AAAA,MACZ,wBACE,KAAA,KAAU,SAAA;AAAA,MACZ,oBACE,KAAA,KAAU;AAAA;AACd,GACF;AAEA,EAAA,uBACEC,cAAA;AAAA,IAAC,OAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAW,OAAA;AAAA,MACX,QAAA;AAAA,MACC,GAAG;AAAA;AAAA,GACN;AAEJ,CAAA;AAEA,IAAO,aAAA,GAAQ","file":"input.cjs","sourcesContent":["import React from 'react';\nimport { classnames } from '../helpers/classnames';\n\ntype InputWidth =\n | 'short'\n | 'default'\n | 'max';\n\nexport interface InputProps\n extends React.InputHTMLAttributes<HTMLInputElement> {\n state?: 'default' | 'error' | 'success';\n width?: InputWidth;\n}\n\nconst Input: React.FC<InputProps> = ({\n state = 'default',\n width = 'default',\n className = '',\n disabled = false,\n ...props\n}) => {\n const classes = classnames(\n 'input',\n className,\n {\n 'input--error':\n state === 'error',\n 'input--success':\n state === 'success',\n 'input--width-short':\n width === 'short',\n 'input--width-default':\n width === 'default',\n 'input--width-max':\n width === 'max',\n },\n );\n\n return (\n <input\n className={classes}\n disabled={disabled}\n {...props}\n />\n );\n};\n\nexport default Input;\n"]}
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
--input-height: var(--size-control-height);
|
|
26
26
|
--input-padding-x: var(--padding-control-horz);
|
|
27
27
|
|
|
28
|
+
box-sizing: border-box;
|
|
28
29
|
height: var(--input-height);
|
|
29
30
|
padding-inline: var(--input-padding-x);
|
|
30
31
|
|
|
@@ -53,6 +54,21 @@
|
|
|
53
54
|
background-color var(--input-transition-duration) ease;
|
|
54
55
|
}
|
|
55
56
|
|
|
57
|
+
.input--width-short {
|
|
58
|
+
/* size */
|
|
59
|
+
width: auto;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.input--width-default {
|
|
63
|
+
/* size */
|
|
64
|
+
width: 400px;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.input--width-max {
|
|
68
|
+
/* size */
|
|
69
|
+
width: 100%;
|
|
70
|
+
}
|
|
71
|
+
|
|
56
72
|
.input::placeholder {
|
|
57
73
|
color: var(--input-placeholder);
|
|
58
74
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
type InputWidth = 'short' | 'default' | 'max';
|
|
2
3
|
export interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
3
4
|
state?: 'default' | 'error' | 'success';
|
|
5
|
+
width?: InputWidth;
|
|
4
6
|
}
|
|
5
7
|
declare const Input: React.FC<InputProps>;
|
|
6
8
|
export default Input;
|
|
@@ -3,14 +3,22 @@ import { classnames } from '../helpers/classnames';
|
|
|
3
3
|
|
|
4
4
|
const Input = ({
|
|
5
5
|
state = "default",
|
|
6
|
+
width = "default",
|
|
6
7
|
className = "",
|
|
7
8
|
disabled = false,
|
|
8
9
|
...props
|
|
9
10
|
}) => {
|
|
10
|
-
const classes = classnames(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
const classes = classnames(
|
|
12
|
+
"input",
|
|
13
|
+
className,
|
|
14
|
+
{
|
|
15
|
+
"input--error": state === "error",
|
|
16
|
+
"input--success": state === "success",
|
|
17
|
+
"input--width-short": width === "short",
|
|
18
|
+
"input--width-default": width === "default",
|
|
19
|
+
"input--width-max": width === "max"
|
|
20
|
+
}
|
|
21
|
+
);
|
|
14
22
|
return /* @__PURE__ */ jsx(
|
|
15
23
|
"input",
|
|
16
24
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/input/input.tsx"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"sources":["../../../src/components/input/input.tsx"],"names":[],"mappings":";;;AAcA,MAAM,QAA8B,CAAC;AAAA,EACnC,KAAA,GAAQ,SAAA;AAAA,EACR,KAAA,GAAQ,SAAA;AAAA,EACR,SAAA,GAAY,EAAA;AAAA,EACZ,QAAA,GAAW,KAAA;AAAA,EACX,GAAG;AACL,CAAA,KAAM;AACJ,EAAA,MAAM,OAAA,GAAU,UAAA;AAAA,IACd,OAAA;AAAA,IACA,SAAA;AAAA,IACA;AAAA,MACE,gBACE,KAAA,KAAU,OAAA;AAAA,MACZ,kBACE,KAAA,KAAU,SAAA;AAAA,MACZ,sBACE,KAAA,KAAU,OAAA;AAAA,MACZ,wBACE,KAAA,KAAU,SAAA;AAAA,MACZ,oBACE,KAAA,KAAU;AAAA;AACd,GACF;AAEA,EAAA,uBACE,GAAA;AAAA,IAAC,OAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAW,OAAA;AAAA,MACX,QAAA;AAAA,MACC,GAAG;AAAA;AAAA,GACN;AAEJ,CAAA;AAEA,IAAO,aAAA,GAAQ","file":"input.js","sourcesContent":["import React from 'react';\nimport { classnames } from '../helpers/classnames';\n\ntype InputWidth =\n | 'short'\n | 'default'\n | 'max';\n\nexport interface InputProps\n extends React.InputHTMLAttributes<HTMLInputElement> {\n state?: 'default' | 'error' | 'success';\n width?: InputWidth;\n}\n\nconst Input: React.FC<InputProps> = ({\n state = 'default',\n width = 'default',\n className = '',\n disabled = false,\n ...props\n}) => {\n const classes = classnames(\n 'input',\n className,\n {\n 'input--error':\n state === 'error',\n 'input--success':\n state === 'success',\n 'input--width-short':\n width === 'short',\n 'input--width-default':\n width === 'default',\n 'input--width-max':\n width === 'max',\n },\n );\n\n return (\n <input\n className={classes}\n disabled={disabled}\n {...props}\n />\n );\n};\n\nexport default Input;\n"]}
|
|
@@ -5,15 +5,23 @@ var classnames = require('../helpers/classnames');
|
|
|
5
5
|
|
|
6
6
|
const Select = ({
|
|
7
7
|
state = "default",
|
|
8
|
+
width = "default",
|
|
8
9
|
className = "",
|
|
9
10
|
disabled = false,
|
|
10
11
|
children,
|
|
11
12
|
...props
|
|
12
13
|
}) => {
|
|
13
|
-
const classes = classnames.classnames(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
const classes = classnames.classnames(
|
|
15
|
+
"select",
|
|
16
|
+
className,
|
|
17
|
+
{
|
|
18
|
+
"select--error": state === "error",
|
|
19
|
+
"select--success": state === "success",
|
|
20
|
+
"select--width-short": width === "short",
|
|
21
|
+
"select--width-default": width === "default",
|
|
22
|
+
"select--width-max": width === "max"
|
|
23
|
+
}
|
|
24
|
+
);
|
|
17
25
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classes, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
18
26
|
"select",
|
|
19
27
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/select/select.tsx"],"names":["classnames","jsx"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"sources":["../../../src/components/select/select.tsx"],"names":["classnames","jsx"],"mappings":";;;;;AAcA,MAAM,SAAgC,CAAC;AAAA,EACrC,KAAA,GAAQ,SAAA;AAAA,EACR,KAAA,GAAQ,SAAA;AAAA,EACR,SAAA,GAAY,EAAA;AAAA,EACZ,QAAA,GAAW,KAAA;AAAA,EACX,QAAA;AAAA,EACA,GAAG;AACL,CAAA,KAAM;AACJ,EAAA,MAAM,OAAA,GAAUA,qBAAA;AAAA,IACd,QAAA;AAAA,IACA,SAAA;AAAA,IACA;AAAA,MACE,iBACE,KAAA,KAAU,OAAA;AAAA,MACZ,mBACE,KAAA,KAAU,SAAA;AAAA,MACZ,uBACE,KAAA,KAAU,OAAA;AAAA,MACZ,yBACE,KAAA,KAAU,SAAA;AAAA,MACZ,qBACE,KAAA,KAAU;AAAA;AACd,GACF;AAEA,EAAA,uBACEC,cAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAW,OAAA,EACd,QAAA,kBAAAA,cAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAU,eAAA;AAAA,MACV,QAAA;AAAA,MACC,GAAG,KAAA;AAAA,MAEH;AAAA;AAAA,GACH,EACF,CAAA;AAEJ,CAAA;AAEA,IAAO,cAAA,GAAQ","file":"select.cjs","sourcesContent":["import React from 'react';\nimport { classnames } from '../helpers/classnames';\n\ntype SelectWidth =\n | 'short'\n | 'default'\n | 'max';\n\nexport interface SelectProps\n extends React.SelectHTMLAttributes<HTMLSelectElement> {\n state?: 'default' | 'error' | 'success';\n width?: SelectWidth;\n}\n\nconst Select: React.FC<SelectProps> = ({\n state = 'default',\n width = 'default',\n className = '',\n disabled = false,\n children,\n ...props\n}) => {\n const classes = classnames(\n 'select',\n className,\n {\n 'select--error':\n state === 'error',\n 'select--success':\n state === 'success',\n 'select--width-short':\n width === 'short',\n 'select--width-default':\n width === 'default',\n 'select--width-max':\n width === 'max',\n },\n );\n\n return (\n <div className={classes}>\n <select\n className=\"select__field\"\n disabled={disabled}\n {...props}\n >\n {children}\n </select>\n </div>\n );\n};\n\nexport default Select;\n"]}
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
|
|
31
31
|
position: relative;
|
|
32
32
|
display: inline-block;
|
|
33
|
-
|
|
33
|
+
box-sizing: border-box;
|
|
34
34
|
|
|
35
35
|
/* border */
|
|
36
36
|
--select-border-width: var(--size-border-width-base);
|
|
@@ -51,6 +51,21 @@
|
|
|
51
51
|
--select-transition-duration: 0.2s;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
.select--width-short {
|
|
55
|
+
/* size */
|
|
56
|
+
width: fit-content;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.select--width-default {
|
|
60
|
+
/* size */
|
|
61
|
+
width: 400px;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.select--width-max {
|
|
65
|
+
/* size */
|
|
66
|
+
width: 100%;
|
|
67
|
+
}
|
|
68
|
+
|
|
54
69
|
.select__field {
|
|
55
70
|
/* color */
|
|
56
71
|
background: var(--select-bg);
|
|
@@ -61,6 +76,7 @@
|
|
|
61
76
|
letter-spacing: inherit;
|
|
62
77
|
|
|
63
78
|
/* size */
|
|
79
|
+
box-sizing: border-box;
|
|
64
80
|
width: 100%;
|
|
65
81
|
height: var(--select-height);
|
|
66
82
|
padding-left: var(--select-padding-x);
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
type SelectWidth = 'short' | 'default' | 'max';
|
|
2
3
|
export interface SelectProps extends React.SelectHTMLAttributes<HTMLSelectElement> {
|
|
3
4
|
state?: 'default' | 'error' | 'success';
|
|
5
|
+
width?: SelectWidth;
|
|
4
6
|
}
|
|
5
7
|
declare const Select: React.FC<SelectProps>;
|
|
6
8
|
export default Select;
|
|
@@ -3,15 +3,23 @@ import { classnames } from '../helpers/classnames';
|
|
|
3
3
|
|
|
4
4
|
const Select = ({
|
|
5
5
|
state = "default",
|
|
6
|
+
width = "default",
|
|
6
7
|
className = "",
|
|
7
8
|
disabled = false,
|
|
8
9
|
children,
|
|
9
10
|
...props
|
|
10
11
|
}) => {
|
|
11
|
-
const classes = classnames(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
const classes = classnames(
|
|
13
|
+
"select",
|
|
14
|
+
className,
|
|
15
|
+
{
|
|
16
|
+
"select--error": state === "error",
|
|
17
|
+
"select--success": state === "success",
|
|
18
|
+
"select--width-short": width === "short",
|
|
19
|
+
"select--width-default": width === "default",
|
|
20
|
+
"select--width-max": width === "max"
|
|
21
|
+
}
|
|
22
|
+
);
|
|
15
23
|
return /* @__PURE__ */ jsx("div", { className: classes, children: /* @__PURE__ */ jsx(
|
|
16
24
|
"select",
|
|
17
25
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/select/select.tsx"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"sources":["../../../src/components/select/select.tsx"],"names":[],"mappings":";;;AAcA,MAAM,SAAgC,CAAC;AAAA,EACrC,KAAA,GAAQ,SAAA;AAAA,EACR,KAAA,GAAQ,SAAA;AAAA,EACR,SAAA,GAAY,EAAA;AAAA,EACZ,QAAA,GAAW,KAAA;AAAA,EACX,QAAA;AAAA,EACA,GAAG;AACL,CAAA,KAAM;AACJ,EAAA,MAAM,OAAA,GAAU,UAAA;AAAA,IACd,QAAA;AAAA,IACA,SAAA;AAAA,IACA;AAAA,MACE,iBACE,KAAA,KAAU,OAAA;AAAA,MACZ,mBACE,KAAA,KAAU,SAAA;AAAA,MACZ,uBACE,KAAA,KAAU,OAAA;AAAA,MACZ,yBACE,KAAA,KAAU,SAAA;AAAA,MACZ,qBACE,KAAA,KAAU;AAAA;AACd,GACF;AAEA,EAAA,uBACE,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAW,OAAA,EACd,QAAA,kBAAA,GAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAU,eAAA;AAAA,MACV,QAAA;AAAA,MACC,GAAG,KAAA;AAAA,MAEH;AAAA;AAAA,GACH,EACF,CAAA;AAEJ,CAAA;AAEA,IAAO,cAAA,GAAQ","file":"select.js","sourcesContent":["import React from 'react';\nimport { classnames } from '../helpers/classnames';\n\ntype SelectWidth =\n | 'short'\n | 'default'\n | 'max';\n\nexport interface SelectProps\n extends React.SelectHTMLAttributes<HTMLSelectElement> {\n state?: 'default' | 'error' | 'success';\n width?: SelectWidth;\n}\n\nconst Select: React.FC<SelectProps> = ({\n state = 'default',\n width = 'default',\n className = '',\n disabled = false,\n children,\n ...props\n}) => {\n const classes = classnames(\n 'select',\n className,\n {\n 'select--error':\n state === 'error',\n 'select--success':\n state === 'success',\n 'select--width-short':\n width === 'short',\n 'select--width-default':\n width === 'default',\n 'select--width-max':\n width === 'max',\n },\n );\n\n return (\n <div className={classes}>\n <select\n className=\"select__field\"\n disabled={disabled}\n {...props}\n >\n {children}\n </select>\n </div>\n );\n};\n\nexport default Select;\n"]}
|
|
@@ -1,23 +1,87 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var react = require('react');
|
|
4
5
|
var classnames = require('../helpers/classnames');
|
|
5
6
|
|
|
7
|
+
function parsePixelValue(value) {
|
|
8
|
+
const parsed = Number.parseFloat(value);
|
|
9
|
+
return Number.isFinite(parsed) ? parsed : 0;
|
|
10
|
+
}
|
|
6
11
|
const Textarea = ({
|
|
7
12
|
state = "default",
|
|
13
|
+
width = "default",
|
|
14
|
+
autoGrow = false,
|
|
8
15
|
className = "",
|
|
9
16
|
disabled = false,
|
|
17
|
+
onInput,
|
|
10
18
|
...props
|
|
11
19
|
}) => {
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
20
|
+
const textareaRef = react.useRef(null);
|
|
21
|
+
const resizeToContent = react.useCallback(() => {
|
|
22
|
+
const textarea = textareaRef.current;
|
|
23
|
+
if (!autoGrow || !textarea) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const computedStyle = window.getComputedStyle(textarea);
|
|
27
|
+
const lineHeight = parsePixelValue(
|
|
28
|
+
computedStyle.lineHeight
|
|
29
|
+
);
|
|
30
|
+
const borderHeight = parsePixelValue(
|
|
31
|
+
computedStyle.borderTopWidth
|
|
32
|
+
) + parsePixelValue(
|
|
33
|
+
computedStyle.borderBottomWidth
|
|
34
|
+
);
|
|
35
|
+
const minHeight = parsePixelValue(
|
|
36
|
+
computedStyle.minHeight
|
|
37
|
+
);
|
|
38
|
+
const previousMinHeight = textarea.style.minHeight;
|
|
39
|
+
textarea.style.minHeight = "0px";
|
|
40
|
+
textarea.style.setProperty(
|
|
41
|
+
"--textarea-auto-height",
|
|
42
|
+
"0px"
|
|
43
|
+
);
|
|
44
|
+
const contentHeight = textarea.scrollHeight;
|
|
45
|
+
textarea.style.minHeight = previousMinHeight;
|
|
46
|
+
const nextHeight = Math.max(
|
|
47
|
+
contentHeight + lineHeight + borderHeight,
|
|
48
|
+
minHeight
|
|
49
|
+
);
|
|
50
|
+
textarea.style.setProperty(
|
|
51
|
+
"--textarea-auto-height",
|
|
52
|
+
`${nextHeight}px`
|
|
53
|
+
);
|
|
54
|
+
}, [autoGrow]);
|
|
55
|
+
react.useLayoutEffect(() => {
|
|
56
|
+
resizeToContent();
|
|
57
|
+
}, [
|
|
58
|
+
resizeToContent,
|
|
59
|
+
props.value,
|
|
60
|
+
width
|
|
61
|
+
]);
|
|
62
|
+
const handleInput = (event) => {
|
|
63
|
+
resizeToContent();
|
|
64
|
+
onInput?.(event);
|
|
65
|
+
};
|
|
66
|
+
const classes = classnames.classnames(
|
|
67
|
+
"textarea",
|
|
68
|
+
className,
|
|
69
|
+
{
|
|
70
|
+
"textarea--error": state === "error",
|
|
71
|
+
"textarea--success": state === "success",
|
|
72
|
+
"textarea--width-short": width === "short",
|
|
73
|
+
"textarea--width-default": width === "default",
|
|
74
|
+
"textarea--width-max": width === "max",
|
|
75
|
+
"textarea--auto-grow": autoGrow
|
|
76
|
+
}
|
|
77
|
+
);
|
|
16
78
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
17
79
|
"textarea",
|
|
18
80
|
{
|
|
81
|
+
ref: textareaRef,
|
|
19
82
|
className: classes,
|
|
20
83
|
disabled,
|
|
84
|
+
onInput: handleInput,
|
|
21
85
|
...props
|
|
22
86
|
}
|
|
23
87
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/textarea/textarea.tsx"],"names":["classnames","jsx"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/components/textarea/textarea.tsx"],"names":["useRef","useCallback","useLayoutEffect","classnames","jsx"],"mappings":";;;;;;AAmBA,SAAS,gBAAgB,KAAA,EAAe;AACtC,EAAA,MAAM,MAAA,GAAS,MAAA,CAAO,UAAA,CAAW,KAAK,CAAA;AAEtC,EAAA,OAAO,MAAA,CAAO,QAAA,CAAS,MAAM,CAAA,GACzB,MAAA,GACA,CAAA;AACN;AAEA,MAAM,WAAoC,CAAC;AAAA,EACzC,KAAA,GAAQ,SAAA;AAAA,EACR,KAAA,GAAQ,SAAA;AAAA,EACR,QAAA,GAAW,KAAA;AAAA,EACX,SAAA,GAAY,EAAA;AAAA,EACZ,QAAA,GA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AAA,IACA,KAAA,CAAM,KAAA;AAAA,IACN;AAAA,GACD,CAAA;AAED,EAAA,MAAM,WAAA,GAAc,CAClB,KAAA,KACG;AACH,IAAA,eAAA,EAAgB;AAChB,IAAA,OAAA,GAAU,KAAK,CAAA;AAAA,EACjB,CAAA;AAEA,EAAA,MAAM,OAAA,GAAUC,qBAAA;AAAA,IACd,UAAA;AAAA,IACA,SAAA;AAAA,IACA;AAAA,MACE,mBACE,KAAA,KAAU,OAAA;AAAA,MACZ,qBACE,KAAA,KAAU,SAAA;AAAA,MACZ,yBACE,KAAA,KAAU,OAAA;AAAA,MACZ,2BACE,KAAA,KAAU,SAAA;AAAA,MACZ,uBACE,KAAA,KAAU,KAAA;AAAA,MACZ,qBAAA,EACE;AAAA;AACJ,GACF;AAEA,EAAA,uBACEC,cAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,GAAA,EAAK,WAAA;AAAA,MACL,SAAA,EAAW,OAAA;AAAA,MACX,QAAA;AAAA,MACA,OAAA,EAAS,WAAA;AAAA,MACR,GAAG;AAAA;AAAA,GACN;AAEJ,CAAA;AAEA,IAAO,gBAAA,GAAQ","file":"textarea.cjs","sourcesContent":["import React, {\n useCallback,\n useLayoutEffect,\n useRef,\n} from 'react';\nimport { classnames } from '../helpers/classnames';\n\ntype TextareaWidth =\n | 'short'\n | 'default'\n | 'max';\n\nexport interface TextareaProps\n extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {\n state?: 'default' | 'error' | 'success';\n width?: TextareaWidth;\n autoGrow?: boolean;\n}\n\nfunction parsePixelValue(value: string) {\n const parsed = Number.parseFloat(value);\n\n return Number.isFinite(parsed)\n ? parsed\n : 0;\n}\n\nconst Textarea: React.FC<TextareaProps> = ({\n state = 'default',\n width = 'default',\n autoGrow = false,\n className = '',\n disabled = false,\n onInput,\n ...props\n}) => {\n const textareaRef =\n useRef<HTMLTextAreaElement>(null);\n\n const resizeToContent =\n useCallback(() => {\n const textarea =\n textareaRef.current;\n\n if (!autoGrow || !textarea) {\n return;\n }\n\n const computedStyle =\n window.getComputedStyle(textarea);\n\n const lineHeight =\n parsePixelValue(\n computedStyle.lineHeight,\n );\n\n const borderHeight =\n parsePixelValue(\n computedStyle.borderTopWidth,\n ) +\n parsePixelValue(\n computedStyle.borderBottomWidth,\n );\n\n const minHeight =\n parsePixelValue(\n computedStyle.minHeight,\n );\n\n const previousMinHeight =\n textarea.style.minHeight;\n\n textarea.style.minHeight =\n '0px';\n\n textarea.style.setProperty(\n '--textarea-auto-height',\n '0px',\n );\n\n const contentHeight =\n textarea.scrollHeight;\n\n textarea.style.minHeight =\n previousMinHeight;\n\n const nextHeight = Math.max(\n contentHeight +\n lineHeight +\n borderHeight,\n minHeight,\n );\n\n textarea.style.setProperty(\n '--textarea-auto-height',\n `${nextHeight}px`,\n );\n }, [autoGrow]);\n\n useLayoutEffect(() => {\n resizeToContent();\n }, [\n resizeToContent,\n props.value,\n width,\n ]);\n\n const handleInput = (\n event: React.InputEvent<HTMLTextAreaElement>,\n ) => {\n resizeToContent();\n onInput?.(event);\n };\n\n const classes = classnames(\n 'textarea',\n className,\n {\n 'textarea--error':\n state === 'error',\n 'textarea--success':\n state === 'success',\n 'textarea--width-short':\n width === 'short',\n 'textarea--width-default':\n width === 'default',\n 'textarea--width-max':\n width === 'max',\n 'textarea--auto-grow':\n autoGrow,\n },\n );\n\n return (\n <textarea\n ref={textareaRef}\n className={classes}\n disabled={disabled}\n onInput={handleInput}\n {...props}\n />\n );\n};\n\nexport default Textarea;\n"]}
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
--textarea-padding-x: var(--padding-control-horz);
|
|
27
27
|
--textarea-padding-y: var(--padding-control-horz);
|
|
28
28
|
|
|
29
|
+
box-sizing: border-box;
|
|
29
30
|
min-height: var(--textarea-min-height);
|
|
30
31
|
padding: var(--textarea-padding-y) var(--textarea-padding-x);
|
|
31
32
|
|
|
@@ -55,6 +56,30 @@
|
|
|
55
56
|
background-color var(--textarea-transition-duration) ease;
|
|
56
57
|
}
|
|
57
58
|
|
|
59
|
+
.textarea--width-short {
|
|
60
|
+
/* size */
|
|
61
|
+
width: auto;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.textarea--width-default {
|
|
65
|
+
/* size */
|
|
66
|
+
width: 400px;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.textarea--width-max {
|
|
70
|
+
/* size */
|
|
71
|
+
width: 100%;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.textarea--auto-grow {
|
|
75
|
+
/* size */
|
|
76
|
+
height: var(--textarea-auto-height);
|
|
77
|
+
|
|
78
|
+
/* motion */
|
|
79
|
+
overflow-y: hidden;
|
|
80
|
+
resize: none;
|
|
81
|
+
}
|
|
82
|
+
|
|
58
83
|
.textarea::placeholder {
|
|
59
84
|
color: var(--textarea-placeholder);
|
|
60
85
|
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
type TextareaWidth = 'short' | 'default' | 'max';
|
|
2
3
|
export interface TextareaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
3
4
|
state?: 'default' | 'error' | 'success';
|
|
5
|
+
width?: TextareaWidth;
|
|
6
|
+
autoGrow?: boolean;
|
|
4
7
|
}
|
|
5
8
|
declare const Textarea: React.FC<TextareaProps>;
|
|
6
9
|
export default Textarea;
|
|
@@ -1,21 +1,85 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useRef, useCallback, useLayoutEffect } from 'react';
|
|
2
3
|
import { classnames } from '../helpers/classnames';
|
|
3
4
|
|
|
5
|
+
function parsePixelValue(value) {
|
|
6
|
+
const parsed = Number.parseFloat(value);
|
|
7
|
+
return Number.isFinite(parsed) ? parsed : 0;
|
|
8
|
+
}
|
|
4
9
|
const Textarea = ({
|
|
5
10
|
state = "default",
|
|
11
|
+
width = "default",
|
|
12
|
+
autoGrow = false,
|
|
6
13
|
className = "",
|
|
7
14
|
disabled = false,
|
|
15
|
+
onInput,
|
|
8
16
|
...props
|
|
9
17
|
}) => {
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
18
|
+
const textareaRef = useRef(null);
|
|
19
|
+
const resizeToContent = useCallback(() => {
|
|
20
|
+
const textarea = textareaRef.current;
|
|
21
|
+
if (!autoGrow || !textarea) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const computedStyle = window.getComputedStyle(textarea);
|
|
25
|
+
const lineHeight = parsePixelValue(
|
|
26
|
+
computedStyle.lineHeight
|
|
27
|
+
);
|
|
28
|
+
const borderHeight = parsePixelValue(
|
|
29
|
+
computedStyle.borderTopWidth
|
|
30
|
+
) + parsePixelValue(
|
|
31
|
+
computedStyle.borderBottomWidth
|
|
32
|
+
);
|
|
33
|
+
const minHeight = parsePixelValue(
|
|
34
|
+
computedStyle.minHeight
|
|
35
|
+
);
|
|
36
|
+
const previousMinHeight = textarea.style.minHeight;
|
|
37
|
+
textarea.style.minHeight = "0px";
|
|
38
|
+
textarea.style.setProperty(
|
|
39
|
+
"--textarea-auto-height",
|
|
40
|
+
"0px"
|
|
41
|
+
);
|
|
42
|
+
const contentHeight = textarea.scrollHeight;
|
|
43
|
+
textarea.style.minHeight = previousMinHeight;
|
|
44
|
+
const nextHeight = Math.max(
|
|
45
|
+
contentHeight + lineHeight + borderHeight,
|
|
46
|
+
minHeight
|
|
47
|
+
);
|
|
48
|
+
textarea.style.setProperty(
|
|
49
|
+
"--textarea-auto-height",
|
|
50
|
+
`${nextHeight}px`
|
|
51
|
+
);
|
|
52
|
+
}, [autoGrow]);
|
|
53
|
+
useLayoutEffect(() => {
|
|
54
|
+
resizeToContent();
|
|
55
|
+
}, [
|
|
56
|
+
resizeToContent,
|
|
57
|
+
props.value,
|
|
58
|
+
width
|
|
59
|
+
]);
|
|
60
|
+
const handleInput = (event) => {
|
|
61
|
+
resizeToContent();
|
|
62
|
+
onInput?.(event);
|
|
63
|
+
};
|
|
64
|
+
const classes = classnames(
|
|
65
|
+
"textarea",
|
|
66
|
+
className,
|
|
67
|
+
{
|
|
68
|
+
"textarea--error": state === "error",
|
|
69
|
+
"textarea--success": state === "success",
|
|
70
|
+
"textarea--width-short": width === "short",
|
|
71
|
+
"textarea--width-default": width === "default",
|
|
72
|
+
"textarea--width-max": width === "max",
|
|
73
|
+
"textarea--auto-grow": autoGrow
|
|
74
|
+
}
|
|
75
|
+
);
|
|
14
76
|
return /* @__PURE__ */ jsx(
|
|
15
77
|
"textarea",
|
|
16
78
|
{
|
|
79
|
+
ref: textareaRef,
|
|
17
80
|
className: classes,
|
|
18
81
|
disabled,
|
|
82
|
+
onInput: handleInput,
|
|
19
83
|
...props
|
|
20
84
|
}
|
|
21
85
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/textarea/textarea.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/components/textarea/textarea.tsx"],"names":[],"mappings":";;;;AAmBA,SAAS,gBAAgB,KAAA,EAAe;AACtC,EAAA,MAAM,MAAA,GAAS,MAAA,CAAO,UAAA,CAAW,KAAK,CAAA;AAEtC,EAAA,OAAO,MAAA,CAAO,QAAA,CAAS,MAAM,CAAA,GACzB,MAAA,GACA,CAAA;AACN;AAEA,MAAM,WAAoC,CAAC;AAAA,EACzC,KAAA,GAAQ,SAAA;AAAA,EACR,KAAA,GAAQ,SAAA;AAAA,EACR,QAAA,GAAW,KAAA;AAAA,EACX,SAAA,GAAY,EAAA;AAAA,EACZ,QAAA,GAAW,KAAA;AAAA,EACX,OAAA;AAAA,EACA,GAAG;AACL,CAAA,KAAM;AACJ,EAAA,MAAM,WAAA,GACJ,OAA4B,IAAI,CAAA;AAElC,EAAA,MAAM,eAAA,GACJ,YAAY,MAAM;AAChB,IAAA,MAAM,WACJ,WAAA,CAAY,OAAA;AAEd,IAAA,IAAI,CAAC,QAAA,IAAY,CAAC,QAAA,EAAU;AAC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IACA;AAAA,MACE,mBACE,KAAA,KAAU,OAAA;AAAA,MACZ,qBACE,KAAA,KAAU,SAAA;AAAA,MACZ,yBACE,KAAA,KAAU,OAAA;AAAA,MACZ,2BACE,KAAA,KAAU,SAAA;AAAA,MACZ,uBACE,KAAA,KAAU,KAAA;AAAA,MACZ,qBAAA,EACE;AAAA;AACJ,GACF;AAEA,EAAA,uBACE,GAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,GAAA,EAAK,WAAA;AAAA,MACL,SAAA,EAAW,OAAA;AAAA,MACX,QAAA;AAAA,MACA,OAAA,EAAS,WAAA;AAAA,MACR,GAAG;AAAA;AAAA,GACN;AAEJ,CAAA;AAEA,IAAO,gBAAA,GAAQ","file":"textarea.js","sourcesContent":["import React, {\n useCallback,\n useLayoutEffect,\n useRef,\n} from 'react';\nimport { classnames } from '../helpers/classnames';\n\ntype TextareaWidth =\n | 'short'\n | 'default'\n | 'max';\n\nexport interface TextareaProps\n extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {\n state?: 'default' | 'error' | 'success';\n width?: TextareaWidth;\n autoGrow?: boolean;\n}\n\nfunction parsePixelValue(value: string) {\n const parsed = Number.parseFloat(value);\n\n return Number.isFinite(parsed)\n ? parsed\n : 0;\n}\n\nconst Textarea: React.FC<TextareaProps> = ({\n state = 'default',\n width = 'default',\n autoGrow = false,\n className = '',\n disabled = false,\n onInput,\n ...props\n}) => {\n const textareaRef =\n useRef<HTMLTextAreaElement>(null);\n\n const resizeToContent =\n useCallback(() => {\n const textarea =\n textareaRef.current;\n\n if (!autoGrow || !textarea) {\n return;\n }\n\n const computedStyle =\n window.getComputedStyle(textarea);\n\n const lineHeight =\n parsePixelValue(\n computedStyle.lineHeight,\n );\n\n const borderHeight =\n parsePixelValue(\n computedStyle.borderTopWidth,\n ) +\n parsePixelValue(\n computedStyle.borderBottomWidth,\n );\n\n const minHeight =\n parsePixelValue(\n computedStyle.minHeight,\n );\n\n const previousMinHeight =\n textarea.style.minHeight;\n\n textarea.style.minHeight =\n '0px';\n\n textarea.style.setProperty(\n '--textarea-auto-height',\n '0px',\n );\n\n const contentHeight =\n textarea.scrollHeight;\n\n textarea.style.minHeight =\n previousMinHeight;\n\n const nextHeight = Math.max(\n contentHeight +\n lineHeight +\n borderHeight,\n minHeight,\n );\n\n textarea.style.setProperty(\n '--textarea-auto-height',\n `${nextHeight}px`,\n );\n }, [autoGrow]);\n\n useLayoutEffect(() => {\n resizeToContent();\n }, [\n resizeToContent,\n props.value,\n width,\n ]);\n\n const handleInput = (\n event: React.InputEvent<HTMLTextAreaElement>,\n ) => {\n resizeToContent();\n onInput?.(event);\n };\n\n const classes = classnames(\n 'textarea',\n className,\n {\n 'textarea--error':\n state === 'error',\n 'textarea--success':\n state === 'success',\n 'textarea--width-short':\n width === 'short',\n 'textarea--width-default':\n width === 'default',\n 'textarea--width-max':\n width === 'max',\n 'textarea--auto-grow':\n autoGrow,\n },\n );\n\n return (\n <textarea\n ref={textareaRef}\n className={classes}\n disabled={disabled}\n onInput={handleInput}\n {...props}\n />\n );\n};\n\nexport default Textarea;\n"]}
|
package/package.json
CHANGED
package/styles.css
CHANGED
|
@@ -2758,7 +2758,7 @@
|
|
|
2758
2758
|
--flip-list-open-content-gap:
|
|
2759
2759
|
var(--font-h2-margin);
|
|
2760
2760
|
--flip-list-trigger-column-gap:
|
|
2761
|
-
var(--margin-
|
|
2761
|
+
var(--margin-icon);
|
|
2762
2762
|
--flip-list-scroll-margin-block-start:
|
|
2763
2763
|
0px;
|
|
2764
2764
|
|
|
@@ -2831,74 +2831,92 @@
|
|
|
2831
2831
|
/* motion */
|
|
2832
2832
|
}
|
|
2833
2833
|
|
|
2834
|
-
.flip-
|
|
2834
|
+
.flip-list__status {
|
|
2835
|
+
/* color */
|
|
2836
|
+
|
|
2837
|
+
/* typography */
|
|
2838
|
+
|
|
2839
|
+
/* size */
|
|
2840
|
+
--flip-list-status-gap:
|
|
2841
|
+
var(--margin-tag);
|
|
2842
|
+
|
|
2843
|
+
display: block;
|
|
2844
|
+
align-self: flex-start;
|
|
2845
|
+
min-width: 0;
|
|
2846
|
+
max-width: 100%;
|
|
2847
|
+
margin:
|
|
2848
|
+
0
|
|
2849
|
+
0
|
|
2850
|
+
var(--flip-list-status-gap)
|
|
2851
|
+
0;
|
|
2852
|
+
|
|
2853
|
+
/* border */
|
|
2854
|
+
|
|
2855
|
+
/* depth */
|
|
2856
|
+
|
|
2857
|
+
/* motion */
|
|
2858
|
+
}
|
|
2859
|
+
|
|
2860
|
+
.flip-list__heading {
|
|
2835
2861
|
/* color */
|
|
2836
|
-
background: transparent;
|
|
2837
|
-
color: var(--flip-list-trigger-color);
|
|
2838
2862
|
|
|
2839
2863
|
/* typography */
|
|
2840
|
-
font: inherit;
|
|
2841
|
-
text-align: left;
|
|
2842
2864
|
|
|
2843
2865
|
/* size */
|
|
2844
2866
|
display: flex;
|
|
2845
2867
|
align-items: center;
|
|
2846
|
-
justify-content: space-between;
|
|
2847
2868
|
gap: var(--flip-list-trigger-column-gap);
|
|
2848
2869
|
width: 100%;
|
|
2849
2870
|
min-width: 0;
|
|
2850
2871
|
max-width: 100%;
|
|
2851
|
-
padding: 0;
|
|
2852
2872
|
|
|
2853
2873
|
/* border */
|
|
2854
|
-
border: 0;
|
|
2855
2874
|
|
|
2856
2875
|
/* depth */
|
|
2857
2876
|
|
|
2858
2877
|
/* motion */
|
|
2859
|
-
cursor: pointer;
|
|
2860
2878
|
}
|
|
2861
2879
|
|
|
2862
|
-
.flip-list__trigger
|
|
2880
|
+
.flip-list__trigger {
|
|
2863
2881
|
/* color */
|
|
2882
|
+
background: transparent;
|
|
2883
|
+
color: var(--flip-list-trigger-color);
|
|
2864
2884
|
|
|
2865
2885
|
/* typography */
|
|
2886
|
+
font: inherit;
|
|
2887
|
+
text-align: left;
|
|
2866
2888
|
|
|
2867
2889
|
/* size */
|
|
2890
|
+
display: flex;
|
|
2891
|
+
flex: 0 1 auto;
|
|
2892
|
+
align-items: center;
|
|
2893
|
+
min-width: 0;
|
|
2894
|
+
max-width: 100%;
|
|
2895
|
+
padding: 0;
|
|
2868
2896
|
|
|
2869
2897
|
/* border */
|
|
2870
|
-
|
|
2871
|
-
var(--size-border-width-focus)
|
|
2872
|
-
solid
|
|
2873
|
-
currentColor;
|
|
2874
|
-
outline-offset:
|
|
2875
|
-
var(--size-border-offset-focus);
|
|
2898
|
+
border: 0;
|
|
2876
2899
|
|
|
2877
2900
|
/* depth */
|
|
2878
2901
|
|
|
2879
2902
|
/* motion */
|
|
2903
|
+
cursor: pointer;
|
|
2880
2904
|
}
|
|
2881
2905
|
|
|
2882
|
-
.flip-
|
|
2906
|
+
.flip-list__trigger:focus-visible {
|
|
2883
2907
|
/* color */
|
|
2884
2908
|
|
|
2885
2909
|
/* typography */
|
|
2886
2910
|
|
|
2887
2911
|
/* size */
|
|
2888
|
-
--flip-list-status-gap:
|
|
2889
|
-
var(--margin-tag);
|
|
2890
|
-
|
|
2891
|
-
display: block;
|
|
2892
|
-
align-self: flex-start;
|
|
2893
|
-
min-width: 0;
|
|
2894
|
-
max-width: 100%;
|
|
2895
|
-
margin:
|
|
2896
|
-
0
|
|
2897
|
-
0
|
|
2898
|
-
var(--flip-list-status-gap)
|
|
2899
|
-
0;
|
|
2900
2912
|
|
|
2901
2913
|
/* border */
|
|
2914
|
+
outline:
|
|
2915
|
+
var(--size-border-width-focus)
|
|
2916
|
+
solid
|
|
2917
|
+
currentColor;
|
|
2918
|
+
outline-offset:
|
|
2919
|
+
var(--size-border-offset-focus);
|
|
2902
2920
|
|
|
2903
2921
|
/* depth */
|
|
2904
2922
|
|
|
@@ -2927,7 +2945,6 @@
|
|
|
2927
2945
|
text-underline-offset: from-font;
|
|
2928
2946
|
|
|
2929
2947
|
/* size */
|
|
2930
|
-
flex: 1 1 auto;
|
|
2931
2948
|
min-width: 0;
|
|
2932
2949
|
max-width: 100%;
|
|
2933
2950
|
overflow-wrap: anywhere;
|
|
@@ -2955,6 +2972,21 @@
|
|
|
2955
2972
|
/* motion */
|
|
2956
2973
|
}
|
|
2957
2974
|
|
|
2975
|
+
.flip-list__status-icon {
|
|
2976
|
+
/* color */
|
|
2977
|
+
|
|
2978
|
+
/* typography */
|
|
2979
|
+
|
|
2980
|
+
/* size */
|
|
2981
|
+
flex: 0 0 auto;
|
|
2982
|
+
|
|
2983
|
+
/* border */
|
|
2984
|
+
|
|
2985
|
+
/* depth */
|
|
2986
|
+
|
|
2987
|
+
/* motion */
|
|
2988
|
+
}
|
|
2989
|
+
|
|
2958
2990
|
.flip-list__meta {
|
|
2959
2991
|
/* color */
|
|
2960
2992
|
color: var(--flip-list-meta-color);
|
|
@@ -2976,6 +3008,7 @@
|
|
|
2976
3008
|
flex: 0 0 auto;
|
|
2977
3009
|
min-width: 0;
|
|
2978
3010
|
max-width: 100%;
|
|
3011
|
+
margin-left: auto;
|
|
2979
3012
|
|
|
2980
3013
|
/* border */
|
|
2981
3014
|
|
|
@@ -3133,6 +3166,7 @@
|
|
|
3133
3166
|
--input-height: var(--size-control-height);
|
|
3134
3167
|
--input-padding-x: var(--padding-control-horz);
|
|
3135
3168
|
|
|
3169
|
+
box-sizing: border-box;
|
|
3136
3170
|
height: var(--input-height);
|
|
3137
3171
|
padding-inline: var(--input-padding-x);
|
|
3138
3172
|
|
|
@@ -3161,6 +3195,21 @@
|
|
|
3161
3195
|
background-color var(--input-transition-duration) ease;
|
|
3162
3196
|
}
|
|
3163
3197
|
|
|
3198
|
+
.input--width-short {
|
|
3199
|
+
/* size */
|
|
3200
|
+
width: auto;
|
|
3201
|
+
}
|
|
3202
|
+
|
|
3203
|
+
.input--width-default {
|
|
3204
|
+
/* size */
|
|
3205
|
+
width: 400px;
|
|
3206
|
+
}
|
|
3207
|
+
|
|
3208
|
+
.input--width-max {
|
|
3209
|
+
/* size */
|
|
3210
|
+
width: 100%;
|
|
3211
|
+
}
|
|
3212
|
+
|
|
3164
3213
|
.input::placeholder {
|
|
3165
3214
|
color: var(--input-placeholder);
|
|
3166
3215
|
}
|
|
@@ -4248,7 +4297,7 @@
|
|
|
4248
4297
|
|
|
4249
4298
|
position: relative;
|
|
4250
4299
|
display: inline-block;
|
|
4251
|
-
|
|
4300
|
+
box-sizing: border-box;
|
|
4252
4301
|
|
|
4253
4302
|
/* border */
|
|
4254
4303
|
--select-border-width: var(--size-border-width-base);
|
|
@@ -4269,6 +4318,21 @@
|
|
|
4269
4318
|
--select-transition-duration: 0.2s;
|
|
4270
4319
|
}
|
|
4271
4320
|
|
|
4321
|
+
.select--width-short {
|
|
4322
|
+
/* size */
|
|
4323
|
+
width: fit-content;
|
|
4324
|
+
}
|
|
4325
|
+
|
|
4326
|
+
.select--width-default {
|
|
4327
|
+
/* size */
|
|
4328
|
+
width: 400px;
|
|
4329
|
+
}
|
|
4330
|
+
|
|
4331
|
+
.select--width-max {
|
|
4332
|
+
/* size */
|
|
4333
|
+
width: 100%;
|
|
4334
|
+
}
|
|
4335
|
+
|
|
4272
4336
|
.select__field {
|
|
4273
4337
|
/* color */
|
|
4274
4338
|
background: var(--select-bg);
|
|
@@ -4279,6 +4343,7 @@
|
|
|
4279
4343
|
letter-spacing: inherit;
|
|
4280
4344
|
|
|
4281
4345
|
/* size */
|
|
4346
|
+
box-sizing: border-box;
|
|
4282
4347
|
width: 100%;
|
|
4283
4348
|
height: var(--select-height);
|
|
4284
4349
|
padding-left: var(--select-padding-x);
|
|
@@ -4684,6 +4749,7 @@
|
|
|
4684
4749
|
--textarea-padding-x: var(--padding-control-horz);
|
|
4685
4750
|
--textarea-padding-y: var(--padding-control-horz);
|
|
4686
4751
|
|
|
4752
|
+
box-sizing: border-box;
|
|
4687
4753
|
min-height: var(--textarea-min-height);
|
|
4688
4754
|
padding: var(--textarea-padding-y) var(--textarea-padding-x);
|
|
4689
4755
|
|
|
@@ -4713,6 +4779,30 @@
|
|
|
4713
4779
|
background-color var(--textarea-transition-duration) ease;
|
|
4714
4780
|
}
|
|
4715
4781
|
|
|
4782
|
+
.textarea--width-short {
|
|
4783
|
+
/* size */
|
|
4784
|
+
width: auto;
|
|
4785
|
+
}
|
|
4786
|
+
|
|
4787
|
+
.textarea--width-default {
|
|
4788
|
+
/* size */
|
|
4789
|
+
width: 400px;
|
|
4790
|
+
}
|
|
4791
|
+
|
|
4792
|
+
.textarea--width-max {
|
|
4793
|
+
/* size */
|
|
4794
|
+
width: 100%;
|
|
4795
|
+
}
|
|
4796
|
+
|
|
4797
|
+
.textarea--auto-grow {
|
|
4798
|
+
/* size */
|
|
4799
|
+
height: var(--textarea-auto-height);
|
|
4800
|
+
|
|
4801
|
+
/* motion */
|
|
4802
|
+
overflow-y: hidden;
|
|
4803
|
+
resize: none;
|
|
4804
|
+
}
|
|
4805
|
+
|
|
4716
4806
|
.textarea::placeholder {
|
|
4717
4807
|
color: var(--textarea-placeholder);
|
|
4718
4808
|
}
|